]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
relay: Don't trigger an address discovery without an ORPort
authorDavid Goulet <dgoulet@torproject.org>
Fri, 22 Jan 2021 15:35:32 +0000 (10:35 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 27 Jan 2021 14:36:17 +0000 (09:36 -0500)
We would before do an address discovery and then a lookup in the cache if not
found which is now simplified by calling relay_find_addr_to_publish() directly
which does all those combined.

Furthermore, by doing so, we won't trigger an address discovery every minute
if we have no ORPort configured for the family.

Fixes #40254

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/ticket40254 [new file with mode: 0644]
src/feature/relay/router.c

diff --git a/changes/ticket40254 b/changes/ticket40254
new file mode 100644 (file)
index 0000000..9945e3d
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes (relay, configuration):
+    - Don't attempt to discover address (IPv4 or IPv6) if no ORPort for it can
+      be found in the configuration. Fixes bug 40254; bugfix on 0.4.5.1-alpha.
+
index e5111acd653a417d4bd5ee6fa7bb0d081d1df29d..4bc71eb486073a39750e21f50c6d4e1ec25b093e 100644 (file)
@@ -2671,18 +2671,11 @@ check_descriptor_ipaddress_changed(time_t now)
       previous = &my_ri->ipv6_addr;
     }
 
-    /* Ignore returned value because we want to notice not only an address
-     * change but also if an address is lost (current == UNSPEC). */
-    bool found = find_my_address(get_options(), family, LOG_INFO, &current,
-                                 &method, &hostname);
-    if (!found) {
-      /* Address was possibly not found because it is simply not configured or
-       * discoverable. Fallback to our cache, which includes any suggestion
-       * sent by a trusted directory server. */
-      found = relay_find_addr_to_publish(get_options(), family,
-                                         RELAY_FIND_ADDR_CACHE_ONLY,
-                                         &current);
-    }
+    /* Attempt to discovery the publishable address for the family which will
+     * actively attempt to discover the address if we are configured with a
+     * port for the family. */
+    relay_find_addr_to_publish(get_options(), family, RELAY_FIND_ADDR_NO_FLAG,
+                               &current);
 
     /* The "current" address might be UNSPEC meaning it was not discovered nor
      * found in our current cache. If we had an address before and we have