From bfaded9143d127cb32407a7a58159383fa9ed333 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sat, 1 Oct 2016 16:34:17 -0400 Subject: [PATCH 1/3] Bridge-using clients now use their cached microdesc consensus Clients that use bridges were ignoring their cached microdesc-flavor consensus files, because they only thought they should use the microdesc flavor once they had a known-working bridge that could offer microdescs, and at first boot no bridges are known-working. This bug caused bridge-using clients to download a new microdesc consensus on each startup. Fixes bug 20269; bugfix on 0.2.3.12-alpha. --- changes/bug20269 | 4 ++++ src/or/entrynodes.c | 21 --------------------- src/or/entrynodes.h | 1 - src/or/microdesc.c | 6 +----- 4 files changed, 5 insertions(+), 27 deletions(-) create mode 100644 changes/bug20269 diff --git a/changes/bug20269 b/changes/bug20269 new file mode 100644 index 0000000000..5d580bf3cc --- /dev/null +++ b/changes/bug20269 @@ -0,0 +1,4 @@ + o Minor bugfixes: + - When clients that use bridges start up with a cached consensus + on disk, they were ignoring it and downloading a new one. Now they + use the cached one. Fixes bug 20269; bugfix on 0.2.3.12-alpha. diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 265b6dcda1..ff02fedbd4 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -2521,27 +2521,6 @@ entries_retry_all(const or_options_t *options) entries_retry_helper(options, 1); } -/** Return true if at least one of our bridges runs a Tor version that can - * provide microdescriptors to us. If not, we'll fall back to asking for - * full descriptors. */ -int -any_bridge_supports_microdescriptors(void) -{ - const node_t *node; - if (!get_options()->UseBridges || !entry_guards) - return 0; - SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, e) { - node = node_get_by_id(e->identity); - if (node && node->is_running && - node_is_bridge(node) && node_is_a_configured_bridge(node)) { - /* This is one of our current bridges, and we know enough about - * it to know that it will be able to answer our questions. */ - return 1; - } - } SMARTLIST_FOREACH_END(e); - return 0; -} - /** Release all storage held by the list of entry guards and related * memory structs. */ void diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h index 1021e67d43..c0374ae24a 100644 --- a/src/or/entrynodes.h +++ b/src/or/entrynodes.h @@ -143,7 +143,6 @@ int any_bridge_descriptors_known(void); int entries_known_but_down(const or_options_t *options); void entries_retry_all(const or_options_t *options); -int any_bridge_supports_microdescriptors(void); const smartlist_t *get_socks_args_by_bridge_addrport(const tor_addr_t *addr, uint16_t port); diff --git a/src/or/microdesc.c b/src/or/microdesc.c index a81dc54628..57efc725a0 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -920,11 +920,7 @@ we_use_microdescriptors_for_circuits(const or_options_t *options) int ret = options->UseMicrodescriptors; if (ret == -1) { /* UseMicrodescriptors is "auto"; we need to decide: */ - /* If we are configured to use bridges and none of our bridges - * know what a microdescriptor is, the answer is no. */ - if (options->UseBridges && !any_bridge_supports_microdescriptors()) - return 0; - /* Otherwise, we decide that we'll use microdescriptors iff we are + /* We'll use microdescriptors iff we are * not a server, and we're not autofetching everything. */ /* XXXX++ what does not being a server have to do with it? also there's * a partitioning issue here where bridges differ from clients. */ From 782b6ec288a553f66e47157d377ec4b200b54394 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sun, 2 Oct 2016 01:12:27 -0400 Subject: [PATCH 2/3] Bridges and relays now use microdescriptors (like clients do) rather than old-style router descriptors. Now bridges will blend in with clients in terms of the circuits they build. Fixes bug 6769; bugfix on 0.2.3.2-alpha. --- changes/bug6769 | 5 +++++ src/or/microdesc.c | 8 ++------ 2 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 changes/bug6769 diff --git a/changes/bug6769 b/changes/bug6769 new file mode 100644 index 0000000000..83e3aa8b9e --- /dev/null +++ b/changes/bug6769 @@ -0,0 +1,5 @@ + o Minor bugfixes: + - Bridges and relays now use microdescriptors (like clients do) + rather than old-style router descriptors. Now bridges will blend in + with clients in terms of the circuits they build. Fixes bug 6769; + bugfix on 0.2.3.2-alpha. diff --git a/src/or/microdesc.c b/src/or/microdesc.c index 57efc725a0..ccb28a914d 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -919,12 +919,8 @@ we_use_microdescriptors_for_circuits(const or_options_t *options) { int ret = options->UseMicrodescriptors; if (ret == -1) { - /* UseMicrodescriptors is "auto"; we need to decide: */ - /* We'll use microdescriptors iff we are - * not a server, and we're not autofetching everything. */ - /* XXXX++ what does not being a server have to do with it? also there's - * a partitioning issue here where bridges differ from clients. */ - ret = !server_mode(options) && !options->FetchUselessDescriptors; + /* UseMicrodescriptors is "auto"; choose yes. */ + return 1; } return ret; } From f0fb55ad30ddcb620943490bf11f591d3b2ba694 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sun, 2 Oct 2016 02:22:03 -0400 Subject: [PATCH 3/3] simplify we_use_microdescriptors_for_circuits() --- src/or/microdesc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/or/microdesc.c b/src/or/microdesc.c index ccb28a914d..140117f683 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -917,12 +917,9 @@ update_microdescs_from_networkstatus(time_t now) int we_use_microdescriptors_for_circuits(const or_options_t *options) { - int ret = options->UseMicrodescriptors; - if (ret == -1) { - /* UseMicrodescriptors is "auto"; choose yes. */ - return 1; - } - return ret; + if (options->UseMicrodescriptors == 0) + return 0; /* the user explicitly picked no */ + return 1; /* yes and auto both mean yes */ } /** Return true iff we should try to download microdescriptors at all. */