From ec2ab3800f9eb7f11c7908ec3783138b4fd21f87 Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Mon, 24 Jan 2011 21:23:59 -0800 Subject: [PATCH 1/5] Fix client side of 2203: Do not count BadExits as Exits. --- src/or/routerlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 47caebf8df..6d6386292f 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1722,7 +1722,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, double weight = 1; if (statuses) { routerstatus_t *status = smartlist_get(sl, i); - is_exit = status->is_exit; + is_exit = status->is_exit && !status->is_bad_exit; is_guard = status->is_possible_guard; is_dir = (status->dir_port != 0); if (!status->has_bandwidth) { @@ -1742,7 +1742,7 @@ smartlist_choose_by_bandwidth_weights(smartlist_t *sl, routerinfo_t *router = smartlist_get(sl, i); rs = router_get_consensus_status_by_id( router->cache_info.identity_digest); - is_exit = router->is_exit; + is_exit = router->is_exit && !router->is_bad_exit; is_guard = router->is_possible_guard; is_dir = (router->dir_port != 0); if (rs && rs->has_bandwidth) { From 7b24b8e37582470214dbb14f5f7b56954ed441f5 Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Mon, 24 Jan 2011 21:35:10 -0800 Subject: [PATCH 2/5] Fix authority side of 2203. Do not add Exit bandwidth to E if BadExit is set. --- src/or/dirvote.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/or/dirvote.c b/src/or/dirvote.c index 41985d1485..529b45c7d5 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -50,7 +50,7 @@ static int dirvote_publish_consensus(void); static char *make_consensus_method_list(int low, int high, const char *sep); /** The highest consensus method that we currently support. */ -#define MAX_SUPPORTED_CONSENSUS_METHOD 10 +#define MAX_SUPPORTED_CONSENSUS_METHOD 11 /** Lowest consensus method that contains a 'directory-footer' marker */ #define MIN_METHOD_FOR_FOOTER 9 @@ -1693,7 +1693,7 @@ networkstatus_compute_consensus(smartlist_t *votes, const char *chosen_name = NULL; int exitsummary_disagreement = 0; int is_named = 0, is_unnamed = 0, is_running = 0; - int is_guard = 0, is_exit = 0; + int is_guard = 0, is_exit = 0, is_bad_exit = 0; int naming_conflict = 0; int n_listing = 0; int i; @@ -1819,6 +1819,8 @@ networkstatus_compute_consensus(smartlist_t *votes, is_guard = 1; else if (!strcmp(fl, "Running")) is_running = 1; + else if (!strcmp(fl, "BadExit")) + is_bad_exit = 1; } } }); @@ -1845,6 +1847,11 @@ networkstatus_compute_consensus(smartlist_t *votes, rs_out.bandwidth = median_uint32(bandwidths, num_bandwidths); } + /* Fix bug 2203: Do not count BadExit nodes as Exits for bw weights */ + if (consensus_method >= 11) { + is_exit = is_exit && !is_bad_exit; + } + if (consensus_method >= MIN_METHOD_FOR_BW_WEIGHTS) { if (rs_out.has_bandwidth) { T += rs_out.bandwidth; From 3ede94159e5e0f3aeceab225eb495051ed7b375e Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Mon, 24 Jan 2011 21:39:29 -0800 Subject: [PATCH 3/5] Add changelog entry for bug2203. --- changes/bug2203 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changes/bug2203 diff --git a/changes/bug2203 b/changes/bug2203 new file mode 100644 index 0000000000..9cfbedf148 --- /dev/null +++ b/changes/bug2203 @@ -0,0 +1,6 @@ + o Minor bugfixes: + - Clients should not weight BadExit nodes as Exits in their node + selection. Similarly, directory authorities should not count + BadExit bandwidth as Exit bandwidth when computing bandwidth-weights. + Bugfix on 0.2.2.10-alpha; fixes bug 2203. + From ffc3caf8d57eb755cfd867d6c0d781c737e26aa1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 25 Jan 2011 17:49:50 -0500 Subject: [PATCH 4/5] Describe consensus method 11 in dir-spec.txt --- doc/spec/dir-spec.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/spec/dir-spec.txt b/doc/spec/dir-spec.txt index eebceeafd6..a883c8871d 100644 --- a/doc/spec/dir-spec.txt +++ b/doc/spec/dir-spec.txt @@ -1618,6 +1618,11 @@ * If consensus-method 7 or later is in use, the params line is included in the output. + * If the conesensus method is under 11, bad exits are considered as + possible exits when computing bandwidth weights. Otherwise, if + method 11 or later is in use, any router that is determined to get + the BadExit flag doesn't count when we're calculating weights. + The signatures at the end of a consensus document are sorted in ascending order by identity digest. From 5774ada5d29ec7abd5a258ff165755c946e97f5f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 26 Jan 2011 11:41:33 -0500 Subject: [PATCH 5/5] Fix typo in dir-spec.txt [found by sebastian] --- doc/spec/dir-spec.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/spec/dir-spec.txt b/doc/spec/dir-spec.txt index a883c8871d..c843a7c41f 100644 --- a/doc/spec/dir-spec.txt +++ b/doc/spec/dir-spec.txt @@ -1618,7 +1618,7 @@ * If consensus-method 7 or later is in use, the params line is included in the output. - * If the conesensus method is under 11, bad exits are considered as + * If the consensus method is under 11, bad exits are considered as possible exits when computing bandwidth weights. Otherwise, if method 11 or later is in use, any router that is determined to get the BadExit flag doesn't count when we're calculating weights.