]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix smartlist_choose_node_by_bandwidth() so that it rejects ORs with BadExit flag.
authorrl1987 <rl1987@sdf.lonestar.org>
Sun, 26 Oct 2014 18:56:15 +0000 (20:56 +0200)
committerNick Mathewson <nickm@torproject.org>
Tue, 28 Oct 2014 18:07:08 +0000 (14:07 -0400)
changes/bug13066 [new file with mode: 0644]
src/or/or.h
src/or/routerlist.c

diff --git a/changes/bug13066 b/changes/bug13066
new file mode 100644 (file)
index 0000000..388c999
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes:
+    - Fix node selection logic in smartlist_choose_node_by_bandwidth()
+      so that onion routers with BadExit flag are not considered to be
+      worthy candidates. Fixes issue 13066.
index 115b92dc94c50e8aa01d1fcd9654024a5977f3ec..2c79c13efb09f2bc74b1c6a361df8355d33ae66d 100644 (file)
@@ -3228,6 +3228,14 @@ static const or_circuit_t *CONST_TO_OR_CIRCUIT(const circuit_t *);
 static origin_circuit_t *TO_ORIGIN_CIRCUIT(circuit_t *);
 static const origin_circuit_t *CONST_TO_ORIGIN_CIRCUIT(const circuit_t *);
 
+/** Return 1 iff <b>node</b> has Exit flag and no BadExit flag.
+ * Otherwise, return 0.
+ */
+static INLINE int node_is_good_exit(const node_t *node)
+{
+  return node->is_exit && ! node->is_bad_exit;
+}
+
 static INLINE or_circuit_t *TO_OR_CIRCUIT(circuit_t *x)
 {
   tor_assert(x->magic == OR_CIRCUIT_MAGIC);
index 4d117cb86de1933d9b1104fd8c3b6b2f319750e0..642b9715521d741090252d8d70825de890be0219 100644 (file)
@@ -2202,7 +2202,7 @@ smartlist_choose_node_by_bandwidth(const smartlist_t *sl,
     uint32_t this_bw = 0;
     i = node_sl_idx;
 
-    is_exit = node->is_exit;
+    is_exit = node_is_good_exit(node);
     is_guard = node->is_possible_guard;
     if (node->rs) {
       if (node->rs->has_bandwidth) {