summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug22036
-rw-r--r--doc/spec/dir-spec.txt5
-rw-r--r--src/or/dirvote.c11
-rw-r--r--src/or/routerlist.c2
4 files changed, 21 insertions, 3 deletions
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.
+
diff --git a/doc/spec/dir-spec.txt b/doc/spec/dir-spec.txt
index df1b798736..49b64e8a92 100644
--- a/doc/spec/dir-spec.txt
+++ b/doc/spec/dir-spec.txt
@@ -1632,6 +1632,11 @@
* If consensus-method 7 or later is in use, the params line is
included in the output.
+ * 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.
+
The signatures at the end of a consensus document are sorted in
ascending order by identity digest.
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 8ef5b14a4f..1052da93c8 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
@@ -1686,7 +1686,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;
@@ -1812,6 +1812,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;
}
}
});
@@ -1838,6 +1840,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;
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 380e34b99c..66066f68d1 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1726,7 +1726,7 @@ smartlist_choose_node_by_bandwidth_weights(smartlist_t *sl,
SMARTLIST_FOREACH_BEGIN(sl, const node_t *, node) {
int is_exit = 0, is_guard = 0, is_dir = 0, this_bw = 0, is_me = 0;
double weight = 1;
- is_exit = node->is_exit;
+ is_exit = node->is_exit && ! node->is_bad_exit;
is_guard = node->is_possible_guard;
is_dir = node_is_dir(node);
if (node->rs) {