From b4f4af6ec5ba16e7ba5191dbd271c1754e0c21d4 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Fri, 22 Jan 2021 10:23:07 -0500 Subject: 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 --- src/feature/relay/relay_find_addr.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/feature/relay') 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); -- cgit v1.2.3-54-g00ecf