[tor-commits] [tor/maint-0.4.5] log more about testing incoming relay descriptors

dgoulet at torproject.org dgoulet at torproject.org
Thu Jan 21 20:01:03 UTC 2021


commit 0b00f79c82894c0bd0ff2d492420f7d9e6101d9e
Author: Roger Dingledine <arma at torproject.org>
Date:   Sat Jan 16 16:11:33 2021 -0500

    log more about testing incoming relay descriptors
---
 src/feature/dirauth/process_descs.c |  8 ++++++--
 src/feature/dirauth/reachability.c  | 14 +++++++++-----
 src/feature/dircache/dircache.c     |  9 +++++++++
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/feature/dirauth/process_descs.c b/src/feature/dirauth/process_descs.c
index b08ffeba07..a382f237c4 100644
--- a/src/feature/dirauth/process_descs.c
+++ b/src/feature/dirauth/process_descs.c
@@ -322,8 +322,9 @@ dirserv_router_get_status(const routerinfo_t *router, const char **msg,
    * and is non-zero (clients check that it's non-zero before using it). */
   if (!routerinfo_has_curve25519_onion_key(router)) {
     log_fn(severity, LD_DIR,
-           "Descriptor from router %s is missing an ntor curve25519 onion "
-           "key.", router_describe(router));
+           "Descriptor from router %s (platform %s) "
+           "is missing an ntor curve25519 onion key.",
+           router_describe(router), router->platform);
     if (msg)
       *msg = "Missing ntor curve25519 onion key. Please upgrade!";
     return RTR_REJECT;
@@ -761,6 +762,9 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
     goto fail;
   }
 
+  log_info(LD_DIR, "Assessing new descriptor: %s: %s",
+           ri->nickname, ri->platform);
+
   /* Check whether this descriptor is semantically identical to the last one
    * from this server.  (We do this here and not in router_add_to_routerlist
    * because we want to be able to accept the newest router descriptor that
diff --git a/src/feature/dirauth/reachability.c b/src/feature/dirauth/reachability.c
index eb88b4aa07..8717646314 100644
--- a/src/feature/dirauth/reachability.c
+++ b/src/feature/dirauth/reachability.c
@@ -110,14 +110,18 @@ dirserv_should_launch_reachability_test(const routerinfo_t *ri,
   if (!ri_old) {
     /* New router: Launch an immediate reachability test, so we will have an
      * opinion soon in case we're generating a consensus soon */
+    log_info(LD_DIR, "descriptor for new router %s", router_describe(ri));
     return 1;
   }
   if (ri_old->is_hibernating && !ri->is_hibernating) {
     /* It just came out of hibernation; launch a reachability test */
+    log_info(LD_DIR, "out of hibernation: router %s", router_describe(ri));
     return 1;
   }
   if (! routers_have_same_or_addrs(ri, ri_old)) {
     /* Address or port changed; launch a reachability test */
+    log_info(LD_DIR, "address or port changed: router %s",
+             router_describe(ri));
     return 1;
   }
   return 0;
@@ -148,7 +152,7 @@ dirserv_single_reachability_test(time_t now, routerinfo_t *router)
   }
 
   /* IPv4. */
-  log_debug(LD_OR,"Testing reachability of %s at %s:%u.",
+  log_info(LD_OR,"Testing reachability of %s at %s:%u.",
             router->nickname, fmt_addr(&router->ipv4_addr),
             router->ipv4_orport);
   chan = channel_tls_connect(&router->ipv4_addr, router->ipv4_orport,
@@ -160,10 +164,10 @@ dirserv_single_reachability_test(time_t now, routerinfo_t *router)
   if (dirauth_get_options()->AuthDirHasIPv6Connectivity == 1 &&
       !tor_addr_is_null(&router->ipv6_addr)) {
     char addrstr[TOR_ADDR_BUF_LEN];
-    log_debug(LD_OR, "Testing reachability of %s at %s:%u.",
-              router->nickname,
-              tor_addr_to_str(addrstr, &router->ipv6_addr, sizeof(addrstr), 1),
-              router->ipv6_orport);
+    log_info(LD_OR, "Testing reachability of %s at %s:%u.",
+             router->nickname,
+             tor_addr_to_str(addrstr, &router->ipv6_addr, sizeof(addrstr), 1),
+             router->ipv6_orport);
     chan = channel_tls_connect(&router->ipv6_addr, router->ipv6_orport,
                                router->cache_info.identity_digest,
                                ed_id_key);
diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c
index 207ea6698b..7f6452afbb 100644
--- a/src/feature/dircache/dircache.c
+++ b/src/feature/dircache/dircache.c
@@ -1675,6 +1675,15 @@ directory_handle_command_post,(dir_connection_t *conn, const char *headers,
     const char *msg = "[None]";
     uint8_t purpose = authdir_mode_bridge(options) ?
                       ROUTER_PURPOSE_BRIDGE : ROUTER_PURPOSE_GENERAL;
+
+    {
+      char *genreason = http_get_header(headers, "X-Desc-Gen-Reason: ");
+      log_info(LD_DIRSERV,
+               "New descriptor post, because: %s",
+               genreason ? genreason : "not specified");
+      tor_free(genreason);
+    }
+
     was_router_added_t r = dirserv_add_multiple_descriptors(body, body_len,
                                            purpose, conn->base_.address, &msg);
     tor_assert(msg);





More information about the tor-commits mailing list