aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2013-03-26 14:15:58 -0700
committerNick Mathewson <nickm@torproject.org>2013-03-29 12:20:54 -0400
commit651e49713c38b8ec2bde285001e46b61c500d10c (patch)
tree97132b2f326cd525f6bda4874df22a4d570a3ad1 /src/or/routerparse.c
parentf6a2f088fdd3b3ed3ccc355c98dde8da37b70a09 (diff)
downloadtor-651e49713c38b8ec2bde285001e46b61c500d10c.tar.gz
tor-651e49713c38b8ec2bde285001e46b61c500d10c.zip
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.
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c13
1 files changed, 10 insertions, 3 deletions
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;