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/connection_edge.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/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 95088c7c17..091c14570a 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -952,8 +952,14 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn, } if (socks->command == SOCKS_COMMAND_RESOLVE_PTR) { + 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_reverse(socks->address, sizeof(socks->address), - &map_expires)) { + rewrite_flags, &map_expires)) { char *result = tor_strdup(socks->address); /* remember _what_ is supposed to have been resolved. */ tor_snprintf(socks->address, sizeof(socks->address), "REVERSE[%s]", @@ -984,8 +990,13 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn, } } else if (!automap) { /* For address map controls, remap the address. */ + 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(socks->address, sizeof(socks->address), - &map_expires, &exit_source)) { + rewrite_flags, &map_expires, &exit_source)) { control_event_stream_status(conn, STREAM_EVENT_REMAP, REMAP_STREAM_SOURCE_CACHE); } |