diff options
author | David Goulet <dgoulet@torproject.org> | 2021-02-10 11:46:32 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2021-02-10 13:24:21 -0500 |
commit | ae5800cd9faccd8c1319601cac7f6c76c4beb288 (patch) | |
tree | 08fdcec354e997917f106b89a7b902284fcf70ef /src/test | |
parent | 758000aa98432414847393420324fef983c66f1e (diff) | |
download | tor-ae5800cd9faccd8c1319601cac7f6c76c4beb288.tar.gz tor-ae5800cd9faccd8c1319601cac7f6c76c4beb288.zip |
relay: Allow RFC1918 addresses for non public relays
In other words, if PublishServerDescriptor is set to 0 and AssumeReachable to
1, then allow a relay to hold a RFC1918 address.
Reasons for this are documented in #40208
Fixes #40208
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_config.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/test_config.c b/src/test/test_config.c index 4eb4ac9cf5..eacf12a25f 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -1460,6 +1460,7 @@ test_config_find_my_address(void *arg) options = options_new(); options_init(options); + options->PublishServerDescriptor_ = V3_DIRINFO; /* * Case 0: @@ -1782,6 +1783,22 @@ test_config_find_my_address(void *arg) VALIDATE_FOUND_ADDRESS(true, RESOLVED_ADDR_INTERFACE, NULL); CLEANUP_FOUND_ADDRESS; + /* + * Case 15: Address is a local address (internal) but we unset + * PublishServerDescriptor_ so we are allowed to hold it. + */ + options->PublishServerDescriptor_ = NO_DIRINFO; + if (p->family == AF_INET) { + options->AssumeReachable = 1; + } + config_line_append(&options->Address, "Address", p->internal_ip); + + tor_addr_parse(&test_addr, p->internal_ip); + retval = find_my_address(options, p->family, LOG_NOTICE, &resolved_addr, + &method_used, &hostname_out); + VALIDATE_FOUND_ADDRESS(true, RESOLVED_ADDR_CONFIGURED, NULL); + CLEANUP_FOUND_ADDRESS; + UNMOCK(get_interface_address6); UNMOCK(tor_gethostname); UNMOCK(tor_addr_lookup); |