log more about testing incoming relay descriptors

This commit is contained in:
Roger Dingledine 2021-01-16 16:11:33 -05:00 committed by David Goulet
parent 71fd30b75a
commit 0b00f79c82
3 changed files with 24 additions and 7 deletions

View File

@ -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). */ * and is non-zero (clients check that it's non-zero before using it). */
if (!routerinfo_has_curve25519_onion_key(router)) { if (!routerinfo_has_curve25519_onion_key(router)) {
log_fn(severity, LD_DIR, log_fn(severity, LD_DIR,
"Descriptor from router %s is missing an ntor curve25519 onion " "Descriptor from router %s (platform %s) "
"key.", router_describe(router)); "is missing an ntor curve25519 onion key.",
router_describe(router), router->platform);
if (msg) if (msg)
*msg = "Missing ntor curve25519 onion key. Please upgrade!"; *msg = "Missing ntor curve25519 onion key. Please upgrade!";
return RTR_REJECT; return RTR_REJECT;
@ -761,6 +762,9 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
goto fail; 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 /* 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 * 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 * because we want to be able to accept the newest router descriptor that

View File

@ -110,14 +110,18 @@ dirserv_should_launch_reachability_test(const routerinfo_t *ri,
if (!ri_old) { if (!ri_old) {
/* New router: Launch an immediate reachability test, so we will have an /* New router: Launch an immediate reachability test, so we will have an
* opinion soon in case we're generating a consensus soon */ * opinion soon in case we're generating a consensus soon */
log_info(LD_DIR, "descriptor for new router %s", router_describe(ri));
return 1; return 1;
} }
if (ri_old->is_hibernating && !ri->is_hibernating) { if (ri_old->is_hibernating && !ri->is_hibernating) {
/* It just came out of hibernation; launch a reachability test */ /* It just came out of hibernation; launch a reachability test */
log_info(LD_DIR, "out of hibernation: router %s", router_describe(ri));
return 1; return 1;
} }
if (! routers_have_same_or_addrs(ri, ri_old)) { if (! routers_have_same_or_addrs(ri, ri_old)) {
/* Address or port changed; launch a reachability test */ /* Address or port changed; launch a reachability test */
log_info(LD_DIR, "address or port changed: router %s",
router_describe(ri));
return 1; return 1;
} }
return 0; return 0;
@ -148,7 +152,7 @@ dirserv_single_reachability_test(time_t now, routerinfo_t *router)
} }
/* IPv4. */ /* 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->nickname, fmt_addr(&router->ipv4_addr),
router->ipv4_orport); router->ipv4_orport);
chan = channel_tls_connect(&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 && if (dirauth_get_options()->AuthDirHasIPv6Connectivity == 1 &&
!tor_addr_is_null(&router->ipv6_addr)) { !tor_addr_is_null(&router->ipv6_addr)) {
char addrstr[TOR_ADDR_BUF_LEN]; char addrstr[TOR_ADDR_BUF_LEN];
log_debug(LD_OR, "Testing reachability of %s at %s:%u.", log_info(LD_OR, "Testing reachability of %s at %s:%u.",
router->nickname, router->nickname,
tor_addr_to_str(addrstr, &router->ipv6_addr, sizeof(addrstr), 1), tor_addr_to_str(addrstr, &router->ipv6_addr, sizeof(addrstr), 1),
router->ipv6_orport); router->ipv6_orport);
chan = channel_tls_connect(&router->ipv6_addr, router->ipv6_orport, chan = channel_tls_connect(&router->ipv6_addr, router->ipv6_orport,
router->cache_info.identity_digest, router->cache_info.identity_digest,
ed_id_key); ed_id_key);

View File

@ -1675,6 +1675,15 @@ directory_handle_command_post,(dir_connection_t *conn, const char *headers,
const char *msg = "[None]"; const char *msg = "[None]";
uint8_t purpose = authdir_mode_bridge(options) ? uint8_t purpose = authdir_mode_bridge(options) ?
ROUTER_PURPOSE_BRIDGE : ROUTER_PURPOSE_GENERAL; 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, was_router_added_t r = dirserv_add_multiple_descriptors(body, body_len,
purpose, conn->base_.address, &msg); purpose, conn->base_.address, &msg);
tor_assert(msg); tor_assert(msg);