diff options
author | David Goulet <dgoulet@torproject.org> | 2021-02-23 09:37:17 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2021-02-23 09:49:45 -0500 |
commit | 39d0f69dfee86c4f8703094990d3169fb20614f3 (patch) | |
tree | 5b01dbd2a73e5a0f43586eeaa861f6263c893458 /src/test/test_config.c | |
parent | bc21ed32903459c53599ee03605e8d23bf42ffe9 (diff) | |
download | tor-39d0f69dfee86c4f8703094990d3169fb20614f3.tar.gz tor-39d0f69dfee86c4f8703094990d3169fb20614f3.zip |
relay: Avoid a directory early fetch
The directory_fetches_from_authorities() is used to know if a client or relay
should fetch data from an authority early in the boot process.
We had a condition in that function that made a relay trigger that fetch if it
didn't know its address (so we can learn it). However, when this is called,
the address discovery has not been done yet so it would always return true for
a relay.
Furthermore, it would always trigger a log notice that the IPv4 couldn't be
found which was inevitable because the address discovery process has not been
done yet (done when building our first descriptor).
It is also important to point out that starting in 0.4.5.1-alpha, asking an
authority for an address is done during address discovery time using a one-hop
circuit thus independent from the relay deciding to fetch or not documents
from an authority.
Small fix also is to reverse the "IPv(4|6)Only" flag in the notice so that if
we can't find IPv6 it would output to use IPv4Only.
Fixes #40300
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_config.c')
-rw-r--r-- | src/test/test_config.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/test/test_config.c b/src/test/test_config.c index 73c8ca0549..655535f704 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -3982,27 +3982,6 @@ test_config_directory_fetch(void *arg) tt_int_op(networkstatus_consensus_can_use_multiple_directories(options), OP_EQ, 1); - /* OR servers only fetch the consensus from the authorities when they don't - * know their own address, but never use multiple directories for bootstrap - */ - or_options_free(options); - options = options_new(); - options->ORPort_set = 1; - - mock_relay_find_addr_to_publish_result = false; - tt_assert(server_mode(options) == 1); - tt_assert(public_server_mode(options) == 1); - tt_int_op(dirclient_fetches_from_authorities(options), OP_EQ, 1); - tt_int_op(networkstatus_consensus_can_use_multiple_directories(options), - OP_EQ, 0); - - mock_relay_find_addr_to_publish_result = true; - tt_assert(server_mode(options) == 1); - tt_assert(public_server_mode(options) == 1); - tt_int_op(dirclient_fetches_from_authorities(options), OP_EQ, 0); - tt_int_op(networkstatus_consensus_can_use_multiple_directories(options), - OP_EQ, 0); - /* Exit OR servers only fetch the consensus from the authorities when they * refuse unknown exits, but never use multiple directories for bootstrap */ |