summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-12-18 21:37:58 +0000
committerRoger Dingledine <arma@torproject.org>2007-12-18 21:37:58 +0000
commitb63a247c6817e099ea3666cc31cd1d24a2cf8fb4 (patch)
treebeee33270cecd56979e3e051219437a98e3e34cb /src/or/dirserv.c
parentbbbf25db4d251ae25b8fe4d5a04f98cf72f7b855 (diff)
downloadtor-b63a247c6817e099ea3666cc31cd1d24a2cf8fb4.tar.gz
tor-b63a247c6817e099ea3666cc31cd1d24a2cf8fb4.zip
Make bridge authorities test reachability of bridges.
Added two XXX020's that we need to think harder about. svn:r12859
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c23
1 files changed, 16 insertions, 7 deletions
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 <b>rs</b>>. If <b>naming</b>, consider setting
* the named flag in <b>rs</b>. If not <b>exits_can_be_guards</b>, never mark
* an exit as a guard. If <b>listbadexits</b>, 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) {