diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-11-25 13:45:36 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-12-17 14:48:09 -0500 |
commit | f33487668f16dbd7f95eaf8644865c28e1dd7036 (patch) | |
tree | bde45b532fddf7d355561ff67ca7af1e98f0309f /src/or/relay.c | |
parent | 32219d83134c861abad5a7d37f93f3ec4b492398 (diff) | |
download | tor-f33487668f16dbd7f95eaf8644865c28e1dd7036.tar.gz tor-f33487668f16dbd7f95eaf8644865c28e1dd7036.zip |
Implement option to turn off DNS cache use on a client port
(This is part 2 of making DNS cache use enabled/disabled on a
per-client port basis. This implements the CacheIPv[46]DNS options,
but not the UseCachedIPv[46] ones.)
Diffstat (limited to 'src/or/relay.c')
-rw-r--r-- | src/or/relay.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/or/relay.c b/src/or/relay.c index 7f49299e2b..608b5fa60e 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -758,10 +758,17 @@ connection_ap_process_end_not_open( policies_set_node_exitpolicy_to_reject_all(exitrouter); } /* rewrite it to an IP if we learned one. */ - if (addressmap_rewrite(conn->socks_request->address, - sizeof(conn->socks_request->address), - NULL, NULL)) { - control_event_stream_status(conn, STREAM_EVENT_REMAP, 0); + { + 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 || conn->chosen_exit_retries) { |