diff options
author | Nick Mathewson <nickm@torproject.org> | 2021-02-08 14:31:13 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2021-02-08 14:31:13 -0500 |
commit | 14e1c2fe0a5b94cfc2db9be0185a3b09fd119e3c (patch) | |
tree | 3d3ce07cf13efc7f1b65a91bd148b73860853d52 /src/feature | |
parent | d6b82d79dca8affbd78e1e95a7efb6be68bc3fab (diff) | |
parent | 758000aa98432414847393420324fef983c66f1e (diff) | |
download | tor-14e1c2fe0a5b94cfc2db9be0185a3b09fd119e3c.tar.gz tor-14e1c2fe0a5b94cfc2db9be0185a3b09fd119e3c.zip |
Merge branch 'maint-0.4.5'
Diffstat (limited to 'src/feature')
-rw-r--r-- | src/feature/relay/router.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index 4fc970683b..7b01bfe6a9 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -138,6 +138,18 @@ static authority_cert_t *legacy_key_certificate = NULL; * used by tor-gencert to sign new signing keys and make new key * certificates. */ +/** Indicate if the IPv6 address should be omitted from the descriptor when + * publishing it. This can happen if the IPv4 is reachable but the + * auto-discovered IPv6 is not. We still publish the descriptor. + * + * Only relays should look at this and only for their descriptor. + * + * XXX: The real harder fix is to never put in the routerinfo_t a non + * reachable address and instead use the last resolved address cache to do + * reachability test or anything that has to do with what address tor thinks + * it has. */ +static bool omit_ipv6_on_publish = false; + /** Return a readonly string with human readable description * of <b>err</b>. */ @@ -1419,7 +1431,11 @@ decide_if_publishable_server(void) return 0; } } - if (!router_orport_seems_reachable(options, AF_INET6)) { + /* We could be flagged to omit the IPv6 and if so, don't check for + * reachability on the IPv6. This can happen if the address was + * auto-discovered but turns out to be non reachable. */ + if (!omit_ipv6_on_publish && + !router_orport_seems_reachable(options, AF_INET6)) { // We have an ipv6 orport, and it doesn't seem reachable. if (!publish_even_when_ipv6_orport_unreachable) { return 0; @@ -2108,7 +2124,8 @@ router_build_fresh_unsigned_routerinfo,(routerinfo_t **ri_out)) ri->ipv4_dirport = routerconf_find_dir_port(options, 0); /* Optionally check for an IPv6. We still publish without one. */ - if (relay_find_addr_to_publish(options, AF_INET6, RELAY_FIND_ADDR_NO_FLAG, + if (!omit_ipv6_on_publish && + relay_find_addr_to_publish(options, AF_INET6, RELAY_FIND_ADDR_NO_FLAG, &ri->ipv6_addr)) { ri->ipv6_orport = routerconf_find_or_port(options, AF_INET6); router_check_descriptor_address_consistency(&ri->ipv6_addr); @@ -2482,18 +2499,6 @@ router_new_consensus_params(const networkstatus_t *ns) publish_even_when_ipv6_orport_unreachable = ar || ar6; } -/** Indicate if the IPv6 address should be omitted from the descriptor when - * publishing it. This can happen if the IPv4 is reachable but the - * auto-discovered IPv6 is not. We still publish the descriptor. - * - * Only relays should look at this and only for their descriptor. - * - * XXX: The real harder fix is to never put in the routerinfo_t a non - * reachable address and instead use the last resolved address cache to do - * reachability test or anything that has to do with what address tor thinks - * it has. */ -static bool omit_ipv6_on_publish = false; - /** Mark our descriptor out of data iff the IPv6 omit status flag is flipped * it changes from its previous value. * |