diff options
author | David Goulet <dgoulet@torproject.org> | 2020-07-21 07:57:21 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-07-21 08:18:31 -0400 |
commit | c3d113a464d4f2e994ae6d1c876875b542f90d5c (patch) | |
tree | 595579453519713c3c07682aa2c4482be052aa39 /src/feature | |
parent | f5d773c600e9902f053d03f47b7812bd1f4796b7 (diff) | |
download | tor-c3d113a464d4f2e994ae6d1c876875b542f90d5c.tar.gz tor-c3d113a464d4f2e994ae6d1c876875b542f90d5c.zip |
relay: Add AddressDisableIPv6 torrc option
This option controls if a tor relay will attempt address auto discovery and
thus ultimately publish an IPv6 ORPort in the descriptor.
Behavior is from proposal 312 section 3.2.6.
Closes #33245
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature')
-rw-r--r-- | src/feature/relay/relay_find_addr.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/feature/relay/relay_find_addr.c b/src/feature/relay/relay_find_addr.c index 48f28b182a..43b958d563 100644 --- a/src/feature/relay/relay_find_addr.c +++ b/src/feature/relay/relay_find_addr.c @@ -105,6 +105,13 @@ relay_find_addr_to_publish, (const or_options_t *options, int family, tor_addr_make_unspec(addr_out); + /* If an IPv6 is requested, check if IPv6 address discovery is disabled on + * this instance. If so, we return a failure. It is done here so we don't + * query the suggested cache that might be populated with an IPv6. */ + if (family == AF_INET6 && options->AddressDisableIPv6) { + 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); |