diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-11-25 13:18:26 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-12-17 14:48:08 -0500 |
commit | d3e9e03cacda3d99f3c585fd7bc00b3dd2390d61 (patch) | |
tree | b72db36bbe095fe9d59314590c8abf91940efefe /src/or/config.c | |
parent | 44a9a47706f4dbca2386b0d5cc5cd3aea5781d59 (diff) | |
download | tor-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/config.c')
-rw-r--r-- | src/or/config.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/or/config.c b/src/or/config.c index e91d24487b..d0d0049511 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -4790,6 +4790,7 @@ parse_port_config(smartlist_t *out, cfg->isolation_flags = ISO_DEFAULT; cfg->no_advertise = 1; cfg->ipv4_traffic = 1; + cfg->cache_ipv4_answers = cfg->use_cached_ipv4_answers = 1; smartlist_add(out, cfg); } } @@ -4814,6 +4815,7 @@ parse_port_config(smartlist_t *out, cfg->session_group = SESSION_GROUP_UNSET; cfg->isolation_flags = ISO_DEFAULT; cfg->ipv4_traffic = 1; + cfg->cache_ipv4_answers = cfg->use_cached_ipv4_answers = 1; smartlist_add(out, cfg); } return 0; @@ -4834,7 +4836,9 @@ parse_port_config(smartlist_t *out, int ok; int no_listen = 0, no_advertise = 0, all_addrs = 0, bind_ipv4_only = 0, bind_ipv6_only = 0, - ipv4_traffic = 1, ipv6_traffic = 0, prefer_ipv6 = 0; + ipv4_traffic = 1, ipv6_traffic = 0, prefer_ipv6 = 0, + cache_ipv4 = 1, use_cached_ipv4 = 1, + cache_ipv6 = 0, use_cached_ipv6 = 0; smartlist_split_string(elts, ports->value, NULL, SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0); @@ -4971,6 +4975,25 @@ parse_port_config(smartlist_t *out, continue; } } + if (!strcasecmp(elt, "CacheIPv4DNS")) { + cache_ipv4 = ! no; + continue; + } else if (!strcasecmp(elt, "CacheIPv6DNS")) { + cache_ipv6 = ! no; + continue; + } else if (!strcasecmp(elt, "CacheDNS")) { + cache_ipv4 = cache_ipv6 = ! no; + continue; + } else if (!strcasecmp(elt, "UseIPv4Cache")) { + use_cached_ipv4 = ! no; + continue; + } else if (!strcasecmp(elt, "UseIPv6Cache")) { + use_cached_ipv6 = ! no; + continue; + } else if (!strcasecmp(elt, "UseDNSCache")) { + use_cached_ipv4 = use_cached_ipv6 = ! no; + continue; + } if (!strcasecmpend(elt, "s")) elt[strlen(elt)-1] = '\0'; /* kill plurals. */ @@ -5024,6 +5047,10 @@ parse_port_config(smartlist_t *out, cfg->ipv4_traffic = ipv4_traffic; cfg->ipv6_traffic = ipv6_traffic; cfg->prefer_ipv6 = prefer_ipv6; + cfg->cache_ipv4_answers = cache_ipv4; + cfg->cache_ipv6_answers = cache_ipv6; + cfg->use_cached_ipv4_answers = use_cached_ipv4; + cfg->use_cached_ipv6_answers = use_cached_ipv6; smartlist_add(out, cfg); } |