diff options
author | David Goulet <dgoulet@torproject.org> | 2020-07-21 13:11:28 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-07-21 15:50:16 -0400 |
commit | 28c1b6047649dad62d269e6c2fde40f41cb9834a (patch) | |
tree | aadb10c6f48ef89deec8fcdc164015484ba811cc /src/feature/relay | |
parent | 803e769fb255f39dba07b5dbc2ca62a43b43004c (diff) | |
download | tor-28c1b6047649dad62d269e6c2fde40f41cb9834a.tar.gz tor-28c1b6047649dad62d269e6c2fde40f41cb9834a.zip |
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>
Diffstat (limited to 'src/feature/relay')
-rw-r--r-- | src/feature/relay/router.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index 997be643dc..97a77f9578 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -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. |