summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2021-02-24 13:55:30 -0500
committerDavid Goulet <dgoulet@torproject.org>2021-02-24 13:55:30 -0500
commitf75baf5ea53025dfd371f392ccfb685e9964b11e (patch)
tree2727452fa4aaa155f57d6727956675342a8a7250 /src
parent830b0f8c6290cf222527c0956ba6d7fe95688b83 (diff)
parent6ea7eb58c697d9e02090f63687803e921bc7c13f (diff)
downloadtor-f75baf5ea53025dfd371f392ccfb685e9964b11e.tar.gz
tor-f75baf5ea53025dfd371f392ccfb685e9964b11e.zip
Merge branch 'maint-0.4.5'
Diffstat (limited to 'src')
-rw-r--r--src/feature/dirclient/dirclient_modes.c8
-rw-r--r--src/feature/relay/relay_find_addr.c15
-rw-r--r--src/feature/relay/relay_find_addr.h2
-rw-r--r--src/test/test_config.c21
4 files changed, 2 insertions, 44 deletions
diff --git a/src/feature/dirclient/dirclient_modes.c b/src/feature/dirclient/dirclient_modes.c
index 62cdad6c36..db25196213 100644
--- a/src/feature/dirclient/dirclient_modes.c
+++ b/src/feature/dirclient/dirclient_modes.c
@@ -45,14 +45,6 @@ dirclient_fetches_from_authorities(const or_options_t *options)
return 1;
if (options->BridgeRelay == 1)
return 0;
- /* We don't know our IP address; ask an authority. IPv4 is still mandatory
- * to have thus if we don't have it, we ought to learn it from an authority
- * through the NETINFO cell or the HTTP header it sends us back.
- *
- * Note that at the moment, relay do a direct connection so no NETINFO cell
- * for now. */
- if (server_mode(options) && !relay_has_address_set(AF_INET))
- return 1;
refuseunknown = ! router_my_exit_policy_is_reject_star() &&
should_refuse_unknown_exits(options);
if (!dir_server_mode(options) && !refuseunknown)
diff --git a/src/feature/relay/relay_find_addr.c b/src/feature/relay/relay_find_addr.c
index 2a3f602438..c43885af51 100644
--- a/src/feature/relay/relay_find_addr.c
+++ b/src/feature/relay/relay_find_addr.c
@@ -162,7 +162,8 @@ relay_find_addr_to_publish, (const or_options_t *options, int family,
"explicit address or set Address.",
fmt_af_family(family),
routerconf_find_or_port(options, family),
- fmt_af_family(family));
+ (family == AF_INET) ? fmt_af_family(AF_INET6) :
+ fmt_af_family(AF_INET));
/* Not found. */
return false;
@@ -171,18 +172,6 @@ relay_find_addr_to_publish, (const or_options_t *options, int family,
return true;
}
-/** Return true iff this relay has an address set for the given family.
- *
- * This only checks the caches so it will not trigger a full discovery of the
- * address. */
-bool
-relay_has_address_set(int family)
-{
- tor_addr_t addr;
- return relay_find_addr_to_publish(get_options(), family,
- RELAY_FIND_ADDR_CACHE_ONLY, &addr);
-}
-
/** How often should we launch a circuit to an authority to be sure of getting
* a guess for our IP? */
#define DUMMY_DOWNLOAD_INTERVAL (20*60)
diff --git a/src/feature/relay/relay_find_addr.h b/src/feature/relay/relay_find_addr.h
index 34890cd34e..f049d1bd20 100644
--- a/src/feature/relay/relay_find_addr.h
+++ b/src/feature/relay/relay_find_addr.h
@@ -22,8 +22,6 @@ MOCK_DECL(bool, relay_find_addr_to_publish,
(const or_options_t *options, int family, int flags,
tor_addr_t *addr_out));
-bool relay_has_address_set(int family);
-
void relay_addr_learn_from_dirauth(void);
#ifdef RELAY_FIND_ADDR_PRIVATE
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 710336cb28..2ed55bb8a9 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -3980,27 +3980,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
*/