diff options
author | David Goulet <dgoulet@torproject.org> | 2021-01-22 10:23:07 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2021-01-27 09:36:17 -0500 |
commit | b4f4af6ec5ba16e7ba5191dbd271c1754e0c21d4 (patch) | |
tree | ea3f1bc9811baf3a2e3db4bb7a860dc2d9ab6be9 /src/feature/relay | |
parent | 5eef63aa718c43312b1a21549bd46a3311bff1b9 (diff) | |
download | tor-b4f4af6ec5ba16e7ba5191dbd271c1754e0c21d4.tar.gz tor-b4f4af6ec5ba16e7ba5191dbd271c1754e0c21d4.zip |
relay: Skip address discovery if no ORPort is found
In other words, if we don't have an ORPort configured for a specific family
(IPv4/v6), we don't bother doing address discovery.
Related to #40254
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/relay')
-rw-r--r-- | src/feature/relay/relay_find_addr.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/feature/relay/relay_find_addr.c b/src/feature/relay/relay_find_addr.c index 2da2328b14..e942a8fa77 100644 --- a/src/feature/relay/relay_find_addr.c +++ b/src/feature/relay/relay_find_addr.c @@ -99,6 +99,13 @@ relay_address_new_suggestion(const tor_addr_t *suggested_addr, * populated by the NETINFO cell content or HTTP header from a * directory. * + * The AddressDisableIPv6 is checked here for IPv6 address discovery and if + * set, false is returned and addr_out is UNSPEC. + * + * Before doing any discovery, the configuration is checked for an ORPort of + * the given family. If none can be found, false is returned and addr_out is + * UNSPEC. + * * Return true on success and addr_out contains the address to use for the * given family. On failure to find the address, false is returned and * addr_out is set to an AF_UNSPEC address. */ @@ -118,6 +125,12 @@ relay_find_addr_to_publish, (const or_options_t *options, int family, return false; } + /* There is no point on attempting an address discovery to publish if we + * don't have an ORPort for this family. */ + if (!routerconf_find_or_port(options, family)) { + return false; + } + /* First, check our resolved address cache. It should contain the address * we've discovered from the periodic relay event. */ resolved_addr_get_last(family, addr_out); |