summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitbuild.c10
-rw-r--r--src/or/connection_edge.c4
-rw-r--r--src/or/dirvote.c4
-rw-r--r--src/or/dirvote.h3
-rw-r--r--src/or/routerparse.c13
-rw-r--r--src/or/routerparse.h2
6 files changed, 24 insertions, 12 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index aec6c6acf2..7db2b70bf7 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);
@@ -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,
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.",
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);