From b63a247c6817e099ea3666cc31cd1d24a2cf8fb4 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 18 Dec 2007 21:37:58 +0000 Subject: Make bridge authorities test reachability of bridges. Added two XXX020's that we need to think harder about. svn:r12859 --- src/or/dirserv.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/or/dirserv.c') diff --git a/src/or/dirserv.c b/src/or/dirserv.c index c8d7b513b8..5f19d15515 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1581,7 +1581,6 @@ static int should_generate_v2_networkstatus(void) { return authdir_mode_v2(get_options()) && - !authdir_mode_bridge(get_options()) && /* XXX020 RD */ the_v2_networkstatus_is_dirty && the_v2_networkstatus_is_dirty + DIR_REGEN_SLACK_TIME < time(NULL); } @@ -1673,7 +1672,7 @@ dirserv_thinks_router_is_unreliable(time_t now, * Right now this means it advertises support for it, it has a high * uptime, and it's currently considered Running. * - * This function needs to be called after router->is_running has + * This function needs to be called after router-\>is_running has * been set. */ static int @@ -1992,7 +1991,11 @@ get_possible_sybil_list(const smartlist_t *routers) * functions and store it in rs>. If naming, consider setting * the named flag in rs. If not exits_can_be_guards, never mark * an exit as a guard. If listbadexits, consider setting the badexit - * flag. */ + * flag. + * + * We assume that ri-\>is_running has already been set, e.g. by + * dirserv_set_router_is_running(ri, now); + */ static void set_routerstatus_from_routerinfo(routerstatus_t *rs, routerinfo_t *ri, time_t now, @@ -2678,6 +2681,7 @@ dirserv_orconn_tls_done(const char *address, { routerlist_t *rl = router_get_routerlist(); time_t now = time(NULL); + int bridge_auth = authdir_mode_bridge(get_options()); tor_assert(address); tor_assert(digest_rcvd); @@ -2686,10 +2690,12 @@ dirserv_orconn_tls_done(const char *address, as_advertised && !memcmp(ri->cache_info.identity_digest, digest_rcvd, DIGEST_LEN)) { /* correct digest. mark this router reachable! */ - log_info(LD_DIRSERV, "Found router %s to be reachable. Yay.", - ri->nickname); - rep_hist_note_router_reachable(digest_rcvd, now); - ri->last_reachable = now; + if (!bridge_auth || ri->purpose == ROUTER_PURPOSE_BRIDGE) { + log_info(LD_DIRSERV, "Found router %s to be reachable. Yay.", + ri->nickname); + rep_hist_note_router_reachable(digest_rcvd, now); + ri->last_reachable = now; + } } }); /* FFFF Maybe we should reinstate the code that dumps routers with the same @@ -2719,11 +2725,14 @@ dirserv_test_reachability(time_t now, int try_all) // time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH; routerlist_t *rl = router_get_routerlist(); static char ctr = 0; + int bridge_auth = authdir_mode_bridge(get_options()); SMARTLIST_FOREACH(rl->routers, routerinfo_t *, router, { const char *id_digest = router->cache_info.identity_digest; if (router_is_me(router)) continue; + if (bridge_auth && router->purpose != ROUTER_PURPOSE_BRIDGE) + continue; /* bridge authorities only test reachability on bridges */ // if (router->cache_info.published_on > cutoff) // continue; if (try_all || (((uint8_t)id_digest[0]) % 128) == ctr) { -- cgit v1.2.3-54-g00ecf