[tor-commits] [tor/master] Make directory node selection more reliable

nickm at torproject.org nickm at torproject.org
Thu May 5 12:25:43 UTC 2016


commit 2e5b35db81e867e782086e3d714fcc7882c9c171
Author: teor (Tim Wilson-Brown) <teor2345 at gmail.com>
Date:   Thu May 5 11:51:37 2016 +1000

    Make directory node selection more reliable
    
    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    |  5 +++++
 src/or/routerlist.c | 12 +++---------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/changes/bug18929 b/changes/bug18929
new file mode 100644
index 0000000..f79baca
--- /dev/null
+++ b/changes/bug18929
@@ -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".
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 3c9023e..2167ae2 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -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);
 





More information about the tor-commits mailing list