From eaf5487d9570fbf2e5bcab911bf7db2f5a70878a Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 20 Apr 2010 03:20:31 -0400 Subject: [PATCH] fetch descriptors from the authority that told us about them --- changes/auths_fetch_from_votes | 9 +++++++++ src/or/routerlist.c | 29 ++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 changes/auths_fetch_from_votes diff --git a/changes/auths_fetch_from_votes b/changes/auths_fetch_from_votes new file mode 100644 index 0000000000..5c451a5dce --- /dev/null +++ b/changes/auths_fetch_from_votes @@ -0,0 +1,9 @@ + o Major bugfixes: + - When we deprecated the v2 directory protocol, we accidentally + got rid of the only way that v3 authorities can hear from each + other about other descriptors. So many relays have been falling + out of the consensus lately because not enough authorities know + about their descriptor for them to get a majority of votes. Now + authorities examine every v3 vote for new descriptors, and fetch + them from that authority. Bugfix on 0.2.1.23. + diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 78af1b8134..3292429e5c 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -26,6 +26,7 @@ static void mark_all_trusteddirservers_up(void); static int router_nickname_matches(routerinfo_t *router, const char *nickname); static void trusted_dir_server_free(trusted_dir_server_t *ds); static void launch_router_descriptor_downloads(smartlist_t *downloadable, + routerstatus_t *source, time_t now); static int signed_desc_digest_is_recognized(signed_descriptor_t *desc); static void update_router_have_minimum_dir_info(void); @@ -4102,7 +4103,8 @@ client_would_use_router(routerstatus_t *rs, time_t now, or_options_t *options) * whether to delay fetching until we have more. If we don't want to delay, * launch one or more requests to the appropriate directory authorities. */ static void -launch_router_descriptor_downloads(smartlist_t *downloadable, time_t now) +launch_router_descriptor_downloads(smartlist_t *downloadable, + routerstatus_t *source, time_t now) { int should_delay = 0, n_downloadable; or_options_t *options = get_options(); @@ -4172,7 +4174,7 @@ launch_router_descriptor_downloads(smartlist_t *downloadable, time_t now) req_plural, n_downloadable, rtr_plural, n_per_request); smartlist_sort_digests(downloadable); for (i=0; i < n_downloadable; i += n_per_request) { - initiate_descriptor_downloads(NULL, DIR_PURPOSE_FETCH_SERVERDESC, + initiate_descriptor_downloads(source, DIR_PURPOSE_FETCH_SERVERDESC, downloadable, i, i+n_per_request, pds_flags); } @@ -4338,6 +4340,7 @@ update_consensus_router_descriptor_downloads(time_t now, int is_vote, digestmap_t *map = NULL; smartlist_t *no_longer_old = smartlist_create(); smartlist_t *downloadable = smartlist_create(); + routerstatus_t *source = NULL; int authdir = authdir_mode(options); int n_delayed=0, n_have=0, n_would_reject=0, n_wouldnt_use=0, n_inprogress=0, n_in_oldrouters=0; @@ -4347,6 +4350,18 @@ update_consensus_router_descriptor_downloads(time_t now, int is_vote, if (!consensus) goto done; + if (is_vote) { + /* where's it from, so we know whom to ask for descriptors */ + trusted_dir_server_t *ds; + networkstatus_voter_info_t *voter = smartlist_get(consensus->voters, 0); + tor_assert(voter); + ds = trusteddirserver_get_by_v3_auth_digest(voter->identity_digest); + if (ds) + source = &(ds->fake_status); + else + log_warn(LD_DIR, "couldn't lookup source from vote?"); + } + map = digestmap_new(); list_pending_descriptor_downloads(map, 0); SMARTLIST_FOREACH(consensus->routerstatus_list, void *, rsp, @@ -4387,6 +4402,14 @@ update_consensus_router_descriptor_downloads(time_t now, int is_vote, ++n_wouldnt_use; continue; /* We would never use it ourself. */ } + if (is_vote && source) { + char time_buf[ISO_TIME_LEN+1]; + format_iso_time(time_buf, rs->published_on); + log_info(LD_DIR, "Learned about %s (%s) from %s's vote (%s)", + rs->nickname, time_buf, source->nickname, + router_get_by_digest(rs->identity_digest) ? "known" : + "unknown"); + } smartlist_add(downloadable, rs->descriptor_digest); }); @@ -4420,7 +4443,7 @@ update_consensus_router_descriptor_downloads(time_t now, int is_vote, smartlist_len(downloadable), n_delayed, n_have, n_in_oldrouters, n_would_reject, n_wouldnt_use, n_inprogress); - launch_router_descriptor_downloads(downloadable, now); + launch_router_descriptor_downloads(downloadable, source, now); digestmap_free(map, NULL); done: -- 2.11.4.GIT