mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Don't use the cache when changing an IP address because of an exit policy
This commit is contained in:
parent
593b235cc9
commit
8eb422e7bd
@ -706,6 +706,7 @@ connection_ap_process_end_not_open(
|
|||||||
case END_STREAM_REASON_EXITPOLICY:
|
case END_STREAM_REASON_EXITPOLICY:
|
||||||
if (rh->length >= 5) {
|
if (rh->length >= 5) {
|
||||||
tor_addr_t addr;
|
tor_addr_t addr;
|
||||||
|
|
||||||
int ttl = -1;
|
int ttl = -1;
|
||||||
tor_addr_make_unspec(&addr);
|
tor_addr_make_unspec(&addr);
|
||||||
if (rh->length == 5 || rh->length == 9) {
|
if (rh->length == 5 || rh->length == 9) {
|
||||||
@ -745,6 +746,16 @@ connection_ap_process_end_not_open(
|
|||||||
client_dns_set_addressmap(conn,
|
client_dns_set_addressmap(conn,
|
||||||
conn->socks_request->address, &addr,
|
conn->socks_request->address, &addr,
|
||||||
conn->chosen_exit_name, ttl);
|
conn->chosen_exit_name, ttl);
|
||||||
|
|
||||||
|
{
|
||||||
|
char new_addr[TOR_ADDR_BUF_LEN];
|
||||||
|
tor_addr_to_str(new_addr, &addr, sizeof(new_addr), 1);
|
||||||
|
if (strcmp(conn->socks_request->address, new_addr)) {
|
||||||
|
strlcpy(conn->socks_request->address, new_addr,
|
||||||
|
sizeof(conn->socks_request->address));
|
||||||
|
control_event_stream_status(conn, STREAM_EVENT_REMAP, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* check if he *ought* to have allowed it */
|
/* check if he *ought* to have allowed it */
|
||||||
if (exitrouter &&
|
if (exitrouter &&
|
||||||
@ -757,19 +768,7 @@ connection_ap_process_end_not_open(
|
|||||||
node_describe(exitrouter));
|
node_describe(exitrouter));
|
||||||
policies_set_node_exitpolicy_to_reject_all(exitrouter);
|
policies_set_node_exitpolicy_to_reject_all(exitrouter);
|
||||||
}
|
}
|
||||||
/* rewrite it to an IP if we learned one. */
|
|
||||||
{
|
|
||||||
unsigned rewrite_flags = 0;
|
|
||||||
if (conn->use_cached_ipv4_answers)
|
|
||||||
rewrite_flags |= AMR_FLAG_USE_IPV4_DNS;
|
|
||||||
if (conn->use_cached_ipv6_answers)
|
|
||||||
rewrite_flags |= AMR_FLAG_USE_IPV6_DNS;
|
|
||||||
if (addressmap_rewrite(conn->socks_request->address,
|
|
||||||
sizeof(conn->socks_request->address),
|
|
||||||
rewrite_flags, NULL, NULL)) {
|
|
||||||
control_event_stream_status(conn, STREAM_EVENT_REMAP, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (conn->chosen_exit_optional ||
|
if (conn->chosen_exit_optional ||
|
||||||
conn->chosen_exit_retries) {
|
conn->chosen_exit_retries) {
|
||||||
/* stop wanting a specific exit */
|
/* stop wanting a specific exit */
|
||||||
|
Loading…
Reference in New Issue
Block a user