]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
relay: Log address suggested by directory authorities
authorDavid Goulet <dgoulet@torproject.org>
Mon, 21 Dec 2020 19:41:52 +0000 (14:41 -0500)
committerDavid Goulet <dgoulet@torproject.org>
Mon, 21 Dec 2020 19:41:52 +0000 (14:41 -0500)
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>
changes/ticket40201 [new file with mode: 0644]
src/app/config/resolve_addr.c

diff --git a/changes/ticket40201 b/changes/ticket40201
new file mode 100644 (file)
index 0000000..cdf8d99
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor bugfixes (logging, relay):
+    - Logs the address discovered by the directory authorities if none were
+      configured or detected before. Fixes bug 40201; bugfix on 0.4.5.1-alpha.
index b811a68b8cffff4fa51b4a916885f717c4a7a0d1..080cb967bc79357143f8a973f2e2dbd36fd626d9 100644 (file)
@@ -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.