From a7d6683629f499c73b3442bbc1d30b057161df11 Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Tue, 26 Mar 2013 11:39:13 -0700 Subject: [PATCH 1/5] Bug 8230: Mark circuits as opened before reachability testing. Should silence two path bias Bug messages seen on relays at startup. --- src/or/circuitbuild.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index aec6c6acf2..3ab534b08f 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -803,6 +803,10 @@ circuit_send_next_onion_skin(origin_circuit_t *circ) control_event_bootstrap(BOOTSTRAP_STATUS_REQUESTING_STATUS, 0); } + pathbias_count_build_success(circ); + circuit_rep_hist_note_result(circ); + circuit_has_opened(circ); /* do other actions as necessary */ + if (!can_complete_circuit && !circ->build_state->onehop_tunnel) { const or_options_t *options = get_options(); can_complete_circuit=1; @@ -819,10 +823,6 @@ circuit_send_next_onion_skin(origin_circuit_t *circ) } } - pathbias_count_build_success(circ); - circuit_rep_hist_note_result(circ); - circuit_has_opened(circ); /* do other actions as necessary */ - /* We're done with measurement circuits here. Just close them */ if (circ->base_.purpose == CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT) { circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_FINISHED); From f6a2f088fdd3b3ed3ccc355c98dde8da37b70a09 Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Tue, 26 Mar 2013 11:43:40 -0700 Subject: [PATCH 2/5] Bug 8477: Don't warn if fromerly GENERAL circuits still have streams. This can happen in various cases of network failure. --- src/or/connection_edge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 9c39c25219..5075c474a3 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -651,7 +651,9 @@ connection_ap_expire_beginning(void) } continue; } - if (circ->purpose != CIRCUIT_PURPOSE_C_GENERAL) { + if (circ->purpose != CIRCUIT_PURPOSE_C_GENERAL && + circ->purpose != CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT && + circ->purpose != CIRCUIT_PURPOSE_PATH_BIAS_TESTING) { log_warn(LD_BUG, "circuit->purpose == CIRCUIT_PURPOSE_C_GENERAL failed. " "The purpose on the circuit was %s; it was in state %s, " "path_state %s.", From 651e49713c38b8ec2bde285001e46b61c500d10c Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Tue, 26 Mar 2013 14:15:58 -0700 Subject: [PATCH 3/5] Bug 8419: Apply the badexit fix from #2203 to validatio too This was causing dirauths to emit flag weight validation warns if there was a sufficiently large amount of badexit bandwidth to make a difference in flag weight results. --- src/or/dirvote.c | 4 ++-- src/or/dirvote.h | 3 +++ src/or/routerparse.c | 13 ++++++++++--- src/or/routerparse.h | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/or/dirvote.c b/src/or/dirvote.c index bcfe2b0698..7043cef245 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -1913,7 +1913,7 @@ networkstatus_compute_consensus(smartlist_t *votes, } /* Fix bug 2203: Do not count BadExit nodes as Exits for bw weights */ - if (consensus_method >= 11) { + if (consensus_method >= MIN_METHOD_TO_CUT_BADEXIT_WEIGHT) { is_exit = is_exit && !is_bad_exit; } @@ -2210,7 +2210,7 @@ networkstatus_compute_consensus(smartlist_t *votes, } // Verify balancing parameters if (consensus_method >= MIN_METHOD_FOR_BW_WEIGHTS && added_weights) { - networkstatus_verify_bw_weights(c); + networkstatus_verify_bw_weights(c, consensus_method); } networkstatus_vote_free(c); } diff --git a/src/or/dirvote.h b/src/or/dirvote.h index fbb61b652f..8d036d6c14 100644 --- a/src/or/dirvote.h +++ b/src/or/dirvote.h @@ -34,6 +34,9 @@ /** Lowest consensus method that generates microdescriptors */ #define MIN_METHOD_FOR_MICRODESC 8 +/** Lowest consensus method that doesn't count bad exits as exits for weight */ +#define MIN_METHOD_TO_CUT_BADEXIT_WEIGHT 11 + /** Lowest consensus method that ensures a majority of authorities voted * for a param. */ #define MIN_METHOD_FOR_MAJORITY_PARAMS 12 diff --git a/src/or/routerparse.c b/src/or/routerparse.c index a2b4f9e0fa..f8edb8407c 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -2257,7 +2257,7 @@ networkstatus_v2_parse_from_string(const char *s) /** Verify the bandwidth weights of a network status document */ int -networkstatus_verify_bw_weights(networkstatus_t *ns) +networkstatus_verify_bw_weights(networkstatus_t *ns, int consensus_method) { int64_t weight_scale; int64_t G=0, M=0, E=0, D=0, T=0; @@ -2343,14 +2343,21 @@ networkstatus_verify_bw_weights(networkstatus_t *ns) // Then, gather G, M, E, D, T to determine case SMARTLIST_FOREACH_BEGIN(ns->routerstatus_list, routerstatus_t *, rs) { + int is_exit = 0; + if (consensus_method >= MIN_METHOD_TO_CUT_BADEXIT_WEIGHT) { + /* Bug #2203: Don't count bad exits as exits for balancing */ + is_exit = rs->is_exit && !rs->is_bad_exit; + } else { + is_exit = rs->is_exit; + } if (rs->has_bandwidth) { T += rs->bandwidth; - if (rs->is_exit && rs->is_possible_guard) { + if (is_exit && rs->is_possible_guard) { D += rs->bandwidth; Gtotal += Wgd*rs->bandwidth; Mtotal += Wmd*rs->bandwidth; Etotal += Wed*rs->bandwidth; - } else if (rs->is_exit) { + } else if (is_exit) { E += rs->bandwidth; Mtotal += Wme*rs->bandwidth; Etotal += Wee*rs->bandwidth; diff --git a/src/or/routerparse.h b/src/or/routerparse.h index 859a691e2a..7bf7d79073 100644 --- a/src/or/routerparse.h +++ b/src/or/routerparse.h @@ -54,7 +54,7 @@ void dump_distinct_digest_count(int severity); int compare_routerstatus_entries(const void **_a, const void **_b); int compare_vote_routerstatus_entries(const void **_a, const void **_b); networkstatus_v2_t *networkstatus_v2_parse_from_string(const char *s); -int networkstatus_verify_bw_weights(networkstatus_t *ns); +int networkstatus_verify_bw_weights(networkstatus_t *ns, int); networkstatus_t *networkstatus_parse_vote_from_string(const char *s, const char **eos_out, networkstatus_type_t ns_type); From 80d8fb23e39e16764447f608428356bd5c49e4c6 Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Tue, 26 Mar 2013 14:22:23 -0700 Subject: [PATCH 4/5] Changes file for 8230, 8477 and 8419. --- changes/log-noise | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 changes/log-noise diff --git a/changes/log-noise b/changes/log-noise new file mode 100644 index 0000000000..bbbf0d2c0c --- /dev/null +++ b/changes/log-noise @@ -0,0 +1,11 @@ + o Minor bugfixes (log message reduction) + - Fix a path state issue that triggered a notice during relay startup. + Fixes bug #8320; bugfix on 0.2.4.10-alpha. + - Reduce occurrences of warns about circuit purpose in + connection_ap_expire_building(). Fixes bug #8477; bugfix on + 0.2.4.11-alpha. + - Fix a directory authority warn caused when we have a large amount + of badexit bandwidth. Fixes bug #8419; bugfix on 0.2.2.10-alpha. + - Reduce a path bias length check notice log to info. The notice + is triggered when creating controller circuits. Fixes bug #8196; + bugfix on 0.2.4.8-alpha. From 9117b142186941f99eae8e07626f12f0b60acd44 Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Tue, 26 Mar 2013 15:57:38 -0700 Subject: [PATCH 5/5] Bug #8196: Demote a path bias notice that can be caused by controllers. We didn't see this in normal usage anyway. --- src/or/circuitbuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 3ab534b08f..7db2b70bf7 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1378,7 +1378,7 @@ pathbias_should_count(origin_circuit_t *circ) if (circ->build_state->desired_path_len != 1 || !circ->build_state->onehop_tunnel) { if ((rate_msg = rate_limit_log(&count_limit, approx_time()))) { - log_notice(LD_BUG, + log_info(LD_BUG, "One-hop circuit has length %d. Path state is %s. " "Circuit is a %s currently %s.%s", circ->build_state->desired_path_len,