From 3ebbc1c84d2daf2853a496d0c997ea7ee883d5e8 Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 25 Aug 2018 01:08:53 +1000 Subject: [PATCH 1/2] Bootstrap: allow internal-only onion service networks to bootstrap This fix requires chutney's 27230 fix to bridge client bootstrap. Part of 27236. --- src/or/nodelist.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 07632861d1..392931d57d 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -2240,11 +2240,11 @@ compute_frac_paths_available(const networkstatus_t *consensus, np, nu); - /* We need at least 1 exit usable in the consensus to consider + /* We need at least 1 exit (flag and policy) in the consensus to consider * building exit paths */ /* Update our understanding of whether the consensus has exits */ consensus_path_type_t old_have_consensus_path = have_consensus_path; - have_consensus_path = ((nu > 0) ? + have_consensus_path = ((np > 0) ? CONSENSUS_PATH_EXIT : CONSENSUS_PATH_INTERNAL); @@ -2342,14 +2342,14 @@ compute_frac_paths_available(const networkstatus_t *consensus, tor_asprintf(status_out, "%d%% of guards bw, " "%d%% of midpoint bw, and " - "%d%% of exit bw%s = " + "%d%% of %s = " "%d%% of path bw", (int)(f_guard*100), (int)(f_mid*100), (int)(f_exit*100), (router_have_consensus_path() == CONSENSUS_PATH_EXIT ? - "" : - " (no exits in consensus)"), + "exit bw" : + "end bw (no exits in consensus)"), (int)(f_path*100)); return f_path; From dd27e17cccc139d55433b313ffee1030cb0cba9f Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 25 Aug 2018 01:11:44 +1000 Subject: [PATCH 2/2] Bootstrap: add some extra logging Diagnostics for 27236. --- src/or/nodelist.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 392931d57d..7540da7eb6 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -2216,9 +2216,20 @@ compute_frac_paths_available(const networkstatus_t *consensus, count_usable_descriptors(num_present_out, num_usable_out, mid, consensus, now, NULL, USABLE_DESCRIPTOR_ALL); + log_debug(LD_NET, + "%s: %d present, %d usable", + "mid", + np, + nu); + if (options->EntryNodes) { count_usable_descriptors(&np, &nu, guards, consensus, now, options->EntryNodes, USABLE_DESCRIPTOR_ALL); + log_debug(LD_NET, + "%s: %d present, %d usable", + "guard", + np, + nu); } else { SMARTLIST_FOREACH(mid, const node_t *, node, { if (authdir) { @@ -2229,6 +2240,10 @@ compute_frac_paths_available(const networkstatus_t *consensus, smartlist_add(guards, (node_t*)node); } }); + log_debug(LD_NET, + "%s: %d possible", + "guard", + smartlist_len(guards)); } /* All nodes with exit policy and flag */ @@ -2248,17 +2263,22 @@ compute_frac_paths_available(const networkstatus_t *consensus, CONSENSUS_PATH_EXIT : CONSENSUS_PATH_INTERNAL); - if (have_consensus_path == CONSENSUS_PATH_INTERNAL - && old_have_consensus_path != have_consensus_path) { - log_notice(LD_NET, - "The current consensus has no exit nodes. " - "Tor can only build internal paths, " - "such as paths to hidden services."); + if (old_have_consensus_path != have_consensus_path) { + if (have_consensus_path == CONSENSUS_PATH_INTERNAL) { + log_notice(LD_NET, + "The current consensus has no exit nodes. " + "Tor can only build internal paths, " + "such as paths to onion services."); - /* However, exit nodes can reachability self-test using this consensus, - * join the network, and appear in a later consensus. This will allow - * the network to build exit paths, such as paths for world wide web - * browsing (as distinct from hidden service web browsing). */ + /* However, exit nodes can reachability self-test using this consensus, + * join the network, and appear in a later consensus. This will allow + * the network to build exit paths, such as paths for world wide web + * browsing (as distinct from hidden service web browsing). */ + } else if (old_have_consensus_path == CONSENSUS_PATH_INTERNAL) { + log_notice(LD_NET, + "The current consensus contains exit nodes. " + "Tor can build exit and internal paths."); + } } f_guard = frac_nodes_with_descriptors(guards, WEIGHT_FOR_GUARD);