relay: Change router_can_extend_over_ipv6() to look at configured port

In routerconf_find_ipv6_or_ap(), we check if the returned ORPort is internal
but not for listening. This means that IPv6 [::] is considered internal.

Thus, we can't use it, we have to look directly at the configured address and
port and if they are valid, we do consider that we have a valid IPv6 ORPort
and that we can thus extend in IPv6.

Related #33246

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2020-07-21 13:11:28 -04:00
parent 803e769fb2
commit 28c1b60476

View File

@ -1526,9 +1526,16 @@ routerconf_find_ipv6_or_ap(const or_options_t *options,
bool
routerconf_has_ipv6_orport(const or_options_t *options)
{
tor_addr_port_t ipv6_ap;
routerconf_find_ipv6_or_ap(options, &ipv6_ap);
return tor_addr_port_is_valid_ap(&ipv6_ap, 0);
/* What we want here is to learn if we have configured an IPv6 ORPort.
* Remember, ORPort can listen on [::] and thus consider internal by
* router_get_advertised_ipv6_or_ap() since we do _not_ want to advertise
* such address. */
const tor_addr_t *addr =
portconf_get_first_advertised_addr(CONN_TYPE_OR_LISTENER, AF_INET6);
const uint16_t port =
routerconf_find_or_port(options, AF_INET6);
return tor_addr_port_is_valid(addr, port, 1);
}
/** Returns true if this router can extend over IPv6.