]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make directory node selection more reliable
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>
Thu, 5 May 2016 01:51:37 +0000 (11:51 +1000)
committerteor (Tim Wilson-Brown) <teor2345@gmail.com>
Thu, 5 May 2016 01:54:53 +0000 (11:54 +1000)
Delete an unnecessary check for non-preferred IP versions.

Allows clients which can't reach any directories of their
preferred IP address version to get directory documents.

Patch on #17840 in 0.2.8.1-alpha.

changes/bug18929 [new file with mode: 0644]
src/or/routerlist.c

diff --git a/changes/bug18929 b/changes/bug18929
new file mode 100644 (file)
index 0000000..f79baca
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (IPv6):
+    - Make directory node selection more reliable, mainly for
+      IPv6-only clients and clients with few reachable addresses.
+      Resolves #18929, bugfix on #17840 in 0.2.8.1-alpha.
+      Patch by "teor".
index 3c9023e8f0dc578c9b00cbcb8143748cbbaf3656..2167ae2bf6bc6084db721e4d9780541aebcbdd9e 100644 (file)
@@ -1597,11 +1597,10 @@ router_picked_poor_directory_log(const routerstatus_t *rs)
   STMT_BEGIN                                                                  \
     if (result == NULL && try_ip_pref && options->ClientUseIPv4               \
         && fascist_firewall_use_ipv6(options) && !server_mode(options)        \
-        && n_not_preferred && !n_busy) {                                      \
+        && !n_busy) {                                                         \
       n_excluded = 0;                                                         \
       n_busy = 0;                                                             \
       try_ip_pref = 0;                                                        \
-      n_not_preferred = 0;                                                    \
       goto retry_label;                                                       \
     }                                                                         \
   STMT_END                                                                    \
@@ -1620,7 +1619,6 @@ router_picked_poor_directory_log(const routerstatus_t *rs)
       n_excluded = 0;                                                         \
       n_busy = 0;                                                             \
       try_ip_pref = 1;                                                        \
-      n_not_preferred = 0;                                                    \
       goto retry_label;                                                       \
     }                                                                         \
   STMT_END
@@ -1673,7 +1671,7 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags,
   const int no_microdesc_fetching = (flags & PDS_NO_EXISTING_MICRODESC_FETCH);
   const int for_guard = (flags & PDS_FOR_GUARD);
   int try_excluding = 1, n_excluded = 0, n_busy = 0;
-  int try_ip_pref = 1, n_not_preferred = 0;
+  int try_ip_pref = 1;
 
   if (!consensus)
     return NULL;
@@ -1750,8 +1748,6 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags,
                                         try_ip_pref))
       smartlist_add(is_trusted ? trusted_direct :
                     is_overloaded ? overloaded_direct : direct, (void*)node);
-    else if (!tor_addr_is_null(&status->ipv6_addr))
-      ++n_not_preferred;
   } SMARTLIST_FOREACH_END(node);
 
   if (smartlist_len(tunnel)) {
@@ -1839,7 +1835,7 @@ router_pick_trusteddirserver_impl(const smartlist_t *sourcelist,
   smartlist_t *pick_from;
   int n_busy = 0;
   int try_excluding = 1, n_excluded = 0;
-  int try_ip_pref = 1, n_not_preferred = 0;
+  int try_ip_pref = 1;
 
   if (!sourcelist)
     return NULL;
@@ -1896,8 +1892,6 @@ router_pick_trusteddirserver_impl(const smartlist_t *sourcelist,
                fascist_firewall_allows_dir_server(d, FIREWALL_DIR_CONNECTION,
                                                   try_ip_pref))
         smartlist_add(is_overloaded ? overloaded_direct : direct, (void*)d);
-      else if (!tor_addr_is_null(&d->ipv6_addr))
-        ++n_not_preferred;
     }
   SMARTLIST_FOREACH_END(d);