diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-11-30 11:48:12 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-11-30 11:48:12 -0500 |
commit | 500f04a74e22686f7659adecea02569b3459c71b (patch) | |
tree | fccc3fdc4cb3a686f05e68fd11b90ca741f84ec6 | |
parent | 703ab95e9fb94700b6349f539c58705040ede9a8 (diff) | |
parent | 766d0a2d98591ed840cce42710c5a59a2e7dc731 (diff) | |
download | tor-500f04a74e22686f7659adecea02569b3459c71b.tar.gz tor-500f04a74e22686f7659adecea02569b3459c71b.zip |
Merge branch 'maint-0.3.0' into maint-0.3.1
-rw-r--r-- | changes/bug21394 | 9 | ||||
-rw-r--r-- | src/or/dns.c | 23 |
2 files changed, 29 insertions, 3 deletions
diff --git a/changes/bug21394 b/changes/bug21394 new file mode 100644 index 0000000000..e5452e20ba --- /dev/null +++ b/changes/bug21394 @@ -0,0 +1,9 @@ + o Major bugfixes (Exit nodes): + - Fix an issue causing high-bandwidth exit nodes to fail a majority + or all of their DNS requests, making them basically unsuitable for + regular usage in Tor circuits. The problem is related to + libevent's DNS handling, but we can work around it in Tor. Fixes + bugs 21394 and 18580; bugfix on 0.1.2.2-alpha which introduced + eventdns. Credit goes to Dhalgren for identifying and finding a + workaround to this bug and to gamambel, arthuredelstein and + arma in helping to track it down and analyze it. diff --git a/src/or/dns.c b/src/or/dns.c index 98b684c904..b5344469b5 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -1426,14 +1426,31 @@ configure_nameservers(int force) #define SET(k,v) evdns_base_set_option(the_evdns_base, (k), (v)) + // If we only have one nameserver, it does not make sense to back off + // from it for a timeout. Unfortunately, the value for max-timeouts is + // currently clamped by libevent to 255, but it does not hurt to set + // it higher in case libevent gets a patch for this. + // Reducing attempts in the case of just one name server too, because + // it is very likely to be a local one where a network connectivity + // issue should not cause an attempt to fail. if (evdns_base_count_nameservers(the_evdns_base) == 1) { - SET("max-timeouts:", "16"); - SET("timeout:", "10"); + SET("max-timeouts:", "1000000"); + SET("attempts:", "1"); } else { SET("max-timeouts:", "3"); - SET("timeout:", "5"); } + // Elongate the queue of maximum inflight dns requests, so if a bunch + // time out at the resolver (happens commonly with unbound) we won't + // stall every other DNS request. This potentially means some wasted + // CPU as there's a walk over a linear queue involved, but this is a + // much better tradeoff compared to just failing DNS requests because + // of a full queue. + SET("max-inflight:", "8192"); + + // Time out after 5 seconds if no reply. + SET("timeout:", "5"); + if (options->ServerDNSRandomizeCase) SET("randomize-case:", "1"); else |