summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-12-21 14:41:52 -0500
committerDavid Goulet <dgoulet@torproject.org>2020-12-21 14:41:52 -0500
commitaae9a05a018b0baed785cb030c941adc4d2c2d12 (patch)
treeafb55dbaf35cfe2564dda671326aac043e6a6337 /src/app
parentad00da663ea008cf47a7a70df21f855bfddad142 (diff)
downloadtor-aae9a05a018b0baed785cb030c941adc4d2c2d12.tar.gz
tor-aae9a05a018b0baed785cb030c941adc4d2c2d12.zip
relay: Log address suggested by directory authorities
If we get an address suggestion from a directory authority and we have no address configured or discovered, log it at notice level so the operator can learn what address will be used by Tor. Fixes #40201 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/resolve_addr.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/app/config/resolve_addr.c b/src/app/config/resolve_addr.c
index b811a68b8c..080cb967bc 100644
--- a/src/app/config/resolve_addr.c
+++ b/src/app/config/resolve_addr.c
@@ -130,8 +130,16 @@ resolved_addr_set_suggested(const tor_addr_t *addr)
tor_addr_family(addr) != AF_INET6)) {
return;
}
- tor_addr_copy(&last_suggested_addrs[af_to_idx(tor_addr_family(addr))],
- addr);
+
+ /* In case we don't have a configured address, log that we will be using the
+ * one discovered from the dirauth. */
+ const int idx = af_to_idx(tor_addr_family(addr));
+ if (tor_addr_is_null(&last_resolved_addrs[idx]) &&
+ !tor_addr_eq(&last_suggested_addrs[idx], addr)) {
+ log_notice(LD_CONFIG, "External address seen and suggested by a "
+ "directory authority: %s", fmt_addr(addr));
+ }
+ tor_addr_copy(&last_suggested_addrs[idx], addr);
}
/** Copy the last resolved address of family into addr_out.