[tor-commits] [tor/master] When a DirAuth checks reachability on itself and has IPv6, mark it as reachable

asn at torproject.org asn at torproject.org
Tue Feb 26 10:36:31 UTC 2019


commit df8ad6473575e217fe69de7d0d12341a1162b95e
Author: Neel Chauhan <neel at neelc.org>
Date:   Fri Feb 22 13:36:02 2019 -0500

    When a DirAuth checks reachability on itself and has IPv6, mark it as reachable
---
 changes/bug24338                |  4 ++++
 src/feature/dirauth/voteflags.c | 18 +++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/changes/bug24338 b/changes/bug24338
new file mode 100644
index 000000000..75984b632
--- /dev/null
+++ b/changes/bug24338
@@ -0,0 +1,4 @@
+  o Minor bugfixes (dirauth, ipv6):
+    - If we are a durauth with IPv6 and are marking relays as running, mark
+      ourselves as reachable on IPv6. Fixes bug 24338; bugfix on 0.4.0.2-alpha.
+      Patch by Neel Chauhan
diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c
index 4f7593a3e..0a53c588d 100644
--- a/src/feature/dirauth/voteflags.c
+++ b/src/feature/dirauth/voteflags.c
@@ -531,6 +531,20 @@ dirserv_set_router_is_running(routerinfo_t *router, time_t now)
   node->is_running = answer;
 }
 
+/* Check <b>node</b> and <b>ri</b> on whether or not we should publish a
+ * relay's IPv6 addresses. */
+static int
+should_publish_node_ipv6(const node_t *node, const routerinfo_t *ri,
+                         time_t now)
+{
+  const or_options_t *options = get_options();
+
+  return options->AuthDirHasIPv6Connectivity == 1 &&
+    !tor_addr_is_null(&ri->ipv6_addr) &&
+    ((node->last_reachable6 >= now - REACHABLE_TIMEOUT) ||
+     router_is_me(ri));
+}
+
 /** Extract status information from <b>ri</b> and from other authority
  * functions and store it in <b>rs</b>. <b>rs</b> is zeroed out before it is
  * set.
@@ -597,9 +611,7 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs,
   rs->is_staledesc =
     (ri->cache_info.published_on + DESC_IS_STALE_INTERVAL) < now;
 
-  if (options->AuthDirHasIPv6Connectivity == 1 &&
-      !tor_addr_is_null(&ri->ipv6_addr) &&
-      node->last_reachable6 >= now - REACHABLE_TIMEOUT) {
+  if (should_publish_node_ipv6(node, ri, now)) {
     /* We're configured as having IPv6 connectivity. There's an IPv6
        OR port and it's reachable so copy it to the routerstatus.  */
     tor_addr_copy(&rs->ipv6_addr, &ri->ipv6_addr);





More information about the tor-commits mailing list