From 210f0c24f039aa6d46b9396ec6bb13ff575a9e79 Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Wed, 25 Oct 2017 19:18:25 +0300 Subject: [PATCH 1/3] Update entry guard state whenever we download a consensus. Update guard state even if we don't have enough dirinfo since that actually affects the future download of dirinfos. Fixes #23862 on 0.3.0.1-alpha --- src/or/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/or/main.c b/src/or/main.c index 478316b79f..1d899349ef 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -965,6 +965,15 @@ directory_info_has_arrived(time_t now, int from_cache, int suppress_logs) { const or_options_t *options = get_options(); + /* if we have enough dir info, then update our guard status with + * whatever we just learned. */ + int invalidate_circs = guards_update_all(); + + if (invalidate_circs) { + circuit_mark_all_unused_circs(); + circuit_mark_all_dirty_circs_as_unusable(); + } + if (!router_have_minimum_dir_info()) { int quiet = suppress_logs || from_cache || directory_too_idle_to_fetch_descriptors(options, now); @@ -978,15 +987,6 @@ directory_info_has_arrived(time_t now, int from_cache, int suppress_logs) update_all_descriptor_downloads(now); } - /* if we have enough dir info, then update our guard status with - * whatever we just learned. */ - int invalidate_circs = guards_update_all(); - - if (invalidate_circs) { - circuit_mark_all_unused_circs(); - circuit_mark_all_dirty_circs_as_unusable(); - } - /* Don't even bother trying to get extrainfo until the rest of our * directory info is up-to-date */ if (options->DownloadExtraInfo) From 1c9f06348671ee72112f2f75d90d7e46cf412b2d Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Wed, 25 Oct 2017 19:18:38 +0300 Subject: [PATCH 2/3] Remove a duplicate call to update_microdesc_downloads() This call happens before we update our entry guards, so it needs to be removed for the fix to #23862 to work. --- src/or/directory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/or/directory.c b/src/or/directory.c index 534e3d6102..48d912bd28 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2122,10 +2122,9 @@ connection_dir_client_reached_eof(dir_connection_t *conn) /* If we launched other fetches for this consensus, cancel them. */ connection_dir_close_consensus_fetches(conn, flavname); - /* launches router downloads as needed */ + /* update the list of routers and directory guards */ routers_update_all_from_networkstatus(now, 3); update_microdescs_from_networkstatus(now); - update_microdesc_downloads(now); directory_info_has_arrived(now, 0, 0); if (authdir_mode_v3(get_options())) { sr_act_post_consensus( From 7ae9e92ffbe5f95d10d8822bfc33eb6a1094be1d Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Wed, 25 Oct 2017 19:54:48 +0300 Subject: [PATCH 3/3] Add changes file for #23862. --- changes/bug23682 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changes/bug23682 diff --git a/changes/bug23682 b/changes/bug23682 new file mode 100644 index 0000000000..301ce73672 --- /dev/null +++ b/changes/bug23682 @@ -0,0 +1,5 @@ + o Minor bugfixes (entry guards): + - Tor now updates its guard state when it reads a consensus regardless of + whether it's missing descriptors. That makes tor use its primary guards + to fetch descriptors in some edge cases where it would have used fallback + directories in the past. Fixes bug 23862; bugfix on 0.3.0.1-alpha. \ No newline at end of file