aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-11-25 13:18:26 -0500
committerNick Mathewson <nickm@torproject.org>2012-12-17 14:48:08 -0500
commitd3e9e03cacda3d99f3c585fd7bc00b3dd2390d61 (patch)
treeb72db36bbe095fe9d59314590c8abf91940efefe /src/or/connection.c
parent44a9a47706f4dbca2386b0d5cc5cd3aea5781d59 (diff)
downloadtor-d3e9e03cacda3d99f3c585fd7bc00b3dd2390d61.tar.gz
tor-d3e9e03cacda3d99f3c585fd7bc00b3dd2390d61.zip
Add options to turn DNS cache use on or off per client port.
(This is part 1 of making DNS cache use enabled/disabled on a per-client port basis. These options are shuffled around correctly, but don't do anything yet.)
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 223bbd938f..1395d3ebd7 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1130,6 +1130,10 @@ connection_listener_new(const struct sockaddr *listensockaddr,
lis_conn->socks_ipv4_traffic = 1;
lis_conn->socks_ipv6_traffic = 1;
}
+ lis_conn->cache_ipv4_answers = port_cfg->cache_ipv4_answers;
+ lis_conn->cache_ipv6_answers = port_cfg->cache_ipv6_answers;
+ lis_conn->use_cached_ipv4_answers = port_cfg->use_cached_ipv4_answers;
+ lis_conn->use_cached_ipv6_answers = port_cfg->use_cached_ipv6_answers;
if (connection_add(conn) < 0) { /* no space, forget it */
log_warn(LD_NET,"connection_add for listener failed. Giving up.");
@@ -1366,6 +1370,13 @@ connection_init_accepted_conn(connection_t *conn,
TO_ENTRY_CONN(conn)->ipv4_traffic_ok = listener->socks_ipv4_traffic;
TO_ENTRY_CONN(conn)->ipv6_traffic_ok = listener->socks_ipv6_traffic;
TO_ENTRY_CONN(conn)->prefer_ipv6_traffic = listener->socks_prefer_ipv6;
+ TO_ENTRY_CONN(conn)->cache_ipv4_answers = listener->cache_ipv4_answers;
+ TO_ENTRY_CONN(conn)->cache_ipv6_answers = listener->cache_ipv6_answers;
+ TO_ENTRY_CONN(conn)->use_cached_ipv4_answers =
+ listener->use_cached_ipv4_answers;
+ TO_ENTRY_CONN(conn)->use_cached_ipv6_answers =
+ listener->use_cached_ipv6_answers;
+
switch (TO_CONN(listener)->type) {
case CONN_TYPE_AP_LISTENER:
conn->state = AP_CONN_STATE_SOCKS_WAIT;