Loading src/or/connection_or.c +1 −1 Original line number Diff line number Diff line Loading @@ -1540,7 +1540,7 @@ connection_or_client_learned_peer_id(or_connection_t *conn, return -1; } if (authdir_mode_tests_reachability(options)) { dirserv_orconn_tls_done(conn->_base.address, conn->_base.port, dirserv_orconn_tls_done(&conn->_base.addr, conn->_base.port, (const char*)peer_id); } Loading src/or/dirserv.c +31 −11 Original line number Diff line number Diff line Loading @@ -3273,14 +3273,15 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, * Inform the reachability checker that we could get to this guy. */ void dirserv_orconn_tls_done(const char *address, dirserv_orconn_tls_done(const tor_addr_t *addr, uint16_t or_port, const char *digest_rcvd) { node_t *node = NULL; tor_addr_port_t orport; routerinfo_t *ri = NULL; time_t now = time(NULL); tor_assert(address); tor_assert(addr); tor_assert(digest_rcvd); node = node_get_mutable_by_id(digest_rcvd); Loading @@ -3288,22 +3289,26 @@ dirserv_orconn_tls_done(const char *address, return; ri = node->ri; if (!strcasecmp(address, ri->address) && or_port == ri->or_port) { tor_addr_copy(&orport.addr, addr); orport.port = or_port; if (router_has_orport(ri, &orport)) { /* Found the right router. */ if (!authdir_mode_bridge(get_options()) || ri->purpose == ROUTER_PURPOSE_BRIDGE) { char addrstr[TOR_ADDR_BUF_LEN]; /* This is a bridge or we're not a bridge authorititative -- mark it as reachable. */ tor_addr_t addr, *addrp=NULL; log_info(LD_DIRSERV, "Found router %s to be reachable at %s:%d. Yay.", router_describe(ri), address, ri->or_port); if (tor_addr_parse(&addr, ri->address) != -1) addrp = &addr; else log_warn(LD_BUG, "Couldn't parse IP address \"%s\"", ri->address); rep_hist_note_router_reachable(digest_rcvd, addrp, or_port, now); tor_addr_to_str(addrstr, addr, sizeof(addrstr), 1), ri->or_port); if (tor_addr_family(addr) == AF_INET) { rep_hist_note_router_reachable(digest_rcvd, addr, or_port, now); node->last_reachable = now; } else if (tor_addr_family(addr) == AF_INET6) { /* No rephist for IPv6. */ node->last_reachable6 = now; } } } } Loading Loading @@ -3345,6 +3350,8 @@ dirserv_single_reachability_test(time_t now, routerinfo_t *router) tor_assert(router); node = node_get_mutable_by_id(router->cache_info.identity_digest); tor_assert(node); /* IPv4. */ log_debug(LD_OR,"Testing reachability of %s at %s:%u.", router->nickname, router->address, router->or_port); /* Remember when we started trying to determine reachability */ Loading @@ -3353,6 +3360,19 @@ dirserv_single_reachability_test(time_t now, routerinfo_t *router) tor_addr_from_ipv4h(&router_addr, router->addr); connection_or_connect(&router_addr, router->or_port, router->cache_info.identity_digest); /* Possible IPv6. */ if (!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); if (!node->testing_since6) node->testing_since6 = now; connection_or_connect(&router->ipv6_addr, router->ipv6_orport, router->cache_info.identity_digest); } } /** Auth dir server only: load balance such that we only Loading src/or/dirserv.h +1 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ int dirserv_get_routerdesc_fingerprints(smartlist_t *fps_out, const char *key, int is_extrainfo); int dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, const char **msg); void dirserv_orconn_tls_done(const char *address, void dirserv_orconn_tls_done(const tor_addr_t *addr, uint16_t or_port, const char *digest_rcvd); int dirserv_should_launch_reachability_test(const routerinfo_t *ri, Loading src/or/nodelist.c +2 −2 Original line number Diff line number Diff line Loading @@ -139,8 +139,8 @@ nodelist_replace_routerinfo(routerinfo_t *old, routerinfo_t *new) if (!routers_have_same_or_addr(old, new)) { /* These mustn't carry over when the address and orport change. */ node->last_reachable = 0; node->testing_since = 0; node->last_reachable = node->last_reachable6 = 0; node->testing_since = node->testing_since6 = 0; } } } else { Loading src/or/or.h +9 −5 Original line number Diff line number Diff line Loading @@ -1997,13 +1997,13 @@ typedef struct node_t { routerstatus_t *rs; /* local info: copied from routerstatus, then possibly frobbed based * on experience. Authorities set this stuff directly. */ * on experience. Authorities set this stuff directly. Note that * these reflect knowledge of the primary (IPv4) OR port only. */ unsigned int is_running:1; /**< As far as we know, is this OR currently * running? */ unsigned int is_valid:1; /**< Has a trusted dirserver validated this OR? * (For Authdir: Have we validated this OR?) */ * (For Authdir: Have we validated this OR?) */ unsigned int is_fast:1; /** Do we think this is a fast OR? */ unsigned int is_stable:1; /** Do we think this is a stable OR? */ unsigned int is_possible_guard:1; /**< Do we think this is an OK guard? */ Loading @@ -2027,15 +2027,19 @@ typedef struct node_t { /* Local info: derived. */ /** According to the geoip db what country is this router in? */ /* XXXprop186 what is this suppose to mean with multiple OR ports? */ country_t country; /* The below items are used only by authdirservers for * reachability testing. */ /** When was the last time we could reach this OR? */ time_t last_reachable; /* IPv4 */ time_t last_reachable; /* IPv4. */ time_t last_reachable6; /* IPv6. */ /** When did we start testing reachability for this OR? */ time_t testing_since; /* IPv4 */ time_t testing_since; /* IPv4. */ time_t testing_since6; /* IPv6. */ } node_t; /** How many times will we try to download a router's descriptor before giving Loading Loading
src/or/connection_or.c +1 −1 Original line number Diff line number Diff line Loading @@ -1540,7 +1540,7 @@ connection_or_client_learned_peer_id(or_connection_t *conn, return -1; } if (authdir_mode_tests_reachability(options)) { dirserv_orconn_tls_done(conn->_base.address, conn->_base.port, dirserv_orconn_tls_done(&conn->_base.addr, conn->_base.port, (const char*)peer_id); } Loading
src/or/dirserv.c +31 −11 Original line number Diff line number Diff line Loading @@ -3273,14 +3273,15 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, * Inform the reachability checker that we could get to this guy. */ void dirserv_orconn_tls_done(const char *address, dirserv_orconn_tls_done(const tor_addr_t *addr, uint16_t or_port, const char *digest_rcvd) { node_t *node = NULL; tor_addr_port_t orport; routerinfo_t *ri = NULL; time_t now = time(NULL); tor_assert(address); tor_assert(addr); tor_assert(digest_rcvd); node = node_get_mutable_by_id(digest_rcvd); Loading @@ -3288,22 +3289,26 @@ dirserv_orconn_tls_done(const char *address, return; ri = node->ri; if (!strcasecmp(address, ri->address) && or_port == ri->or_port) { tor_addr_copy(&orport.addr, addr); orport.port = or_port; if (router_has_orport(ri, &orport)) { /* Found the right router. */ if (!authdir_mode_bridge(get_options()) || ri->purpose == ROUTER_PURPOSE_BRIDGE) { char addrstr[TOR_ADDR_BUF_LEN]; /* This is a bridge or we're not a bridge authorititative -- mark it as reachable. */ tor_addr_t addr, *addrp=NULL; log_info(LD_DIRSERV, "Found router %s to be reachable at %s:%d. Yay.", router_describe(ri), address, ri->or_port); if (tor_addr_parse(&addr, ri->address) != -1) addrp = &addr; else log_warn(LD_BUG, "Couldn't parse IP address \"%s\"", ri->address); rep_hist_note_router_reachable(digest_rcvd, addrp, or_port, now); tor_addr_to_str(addrstr, addr, sizeof(addrstr), 1), ri->or_port); if (tor_addr_family(addr) == AF_INET) { rep_hist_note_router_reachable(digest_rcvd, addr, or_port, now); node->last_reachable = now; } else if (tor_addr_family(addr) == AF_INET6) { /* No rephist for IPv6. */ node->last_reachable6 = now; } } } } Loading Loading @@ -3345,6 +3350,8 @@ dirserv_single_reachability_test(time_t now, routerinfo_t *router) tor_assert(router); node = node_get_mutable_by_id(router->cache_info.identity_digest); tor_assert(node); /* IPv4. */ log_debug(LD_OR,"Testing reachability of %s at %s:%u.", router->nickname, router->address, router->or_port); /* Remember when we started trying to determine reachability */ Loading @@ -3353,6 +3360,19 @@ dirserv_single_reachability_test(time_t now, routerinfo_t *router) tor_addr_from_ipv4h(&router_addr, router->addr); connection_or_connect(&router_addr, router->or_port, router->cache_info.identity_digest); /* Possible IPv6. */ if (!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); if (!node->testing_since6) node->testing_since6 = now; connection_or_connect(&router->ipv6_addr, router->ipv6_orport, router->cache_info.identity_digest); } } /** Auth dir server only: load balance such that we only Loading
src/or/dirserv.h +1 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ int dirserv_get_routerdesc_fingerprints(smartlist_t *fps_out, const char *key, int is_extrainfo); int dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, const char **msg); void dirserv_orconn_tls_done(const char *address, void dirserv_orconn_tls_done(const tor_addr_t *addr, uint16_t or_port, const char *digest_rcvd); int dirserv_should_launch_reachability_test(const routerinfo_t *ri, Loading
src/or/nodelist.c +2 −2 Original line number Diff line number Diff line Loading @@ -139,8 +139,8 @@ nodelist_replace_routerinfo(routerinfo_t *old, routerinfo_t *new) if (!routers_have_same_or_addr(old, new)) { /* These mustn't carry over when the address and orport change. */ node->last_reachable = 0; node->testing_since = 0; node->last_reachable = node->last_reachable6 = 0; node->testing_since = node->testing_since6 = 0; } } } else { Loading
src/or/or.h +9 −5 Original line number Diff line number Diff line Loading @@ -1997,13 +1997,13 @@ typedef struct node_t { routerstatus_t *rs; /* local info: copied from routerstatus, then possibly frobbed based * on experience. Authorities set this stuff directly. */ * on experience. Authorities set this stuff directly. Note that * these reflect knowledge of the primary (IPv4) OR port only. */ unsigned int is_running:1; /**< As far as we know, is this OR currently * running? */ unsigned int is_valid:1; /**< Has a trusted dirserver validated this OR? * (For Authdir: Have we validated this OR?) */ * (For Authdir: Have we validated this OR?) */ unsigned int is_fast:1; /** Do we think this is a fast OR? */ unsigned int is_stable:1; /** Do we think this is a stable OR? */ unsigned int is_possible_guard:1; /**< Do we think this is an OK guard? */ Loading @@ -2027,15 +2027,19 @@ typedef struct node_t { /* Local info: derived. */ /** According to the geoip db what country is this router in? */ /* XXXprop186 what is this suppose to mean with multiple OR ports? */ country_t country; /* The below items are used only by authdirservers for * reachability testing. */ /** When was the last time we could reach this OR? */ time_t last_reachable; /* IPv4 */ time_t last_reachable; /* IPv4. */ time_t last_reachable6; /* IPv6. */ /** When did we start testing reachability for this OR? */ time_t testing_since; /* IPv4 */ time_t testing_since; /* IPv4. */ time_t testing_since6; /* IPv6. */ } node_t; /** How many times will we try to download a router's descriptor before giving Loading