aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-10-08 11:48:33 -0400
committerNick Mathewson <nickm@torproject.org>2013-10-08 11:48:33 -0400
commitc8c22980151b220ec79fc2979bc7db3a9fe962d5 (patch)
tree1f739b7bae458cf0f397e1be2eececa0a6d534a4 /src/or/circuitbuild.c
parent245ecfff36c0cecc8e4aef5ad8c062d7d4c07955 (diff)
downloadtor-c8c22980151b220ec79fc2979bc7db3a9fe962d5.tar
tor-c8c22980151b220ec79fc2979bc7db3a9fe962d5.tar.gz
Simply route length generation code.
The old code had logic to use a shorter path length if we didn't have enough nodes. But we don't support 2-node networks anwyay. Fix for #9926. I'm not calling this a bugfix on any particular version, since a 2-node network would fail to work for you for a lot of other reasons too, and it's not clear to me when that began, or if 2-node networks would ever have worked.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index a203ceeef..a685b0b27 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2762,11 +2762,7 @@ onionskin_answer(or_circuit_t *circ,
* number of endpoints that would give something away about our destination.
*
* If the routerlist <b>nodes</b> doesn't have enough routers
- * to handle the desired path length, return as large a path length as
- * is feasible, except if it's less than 2, in which case return -1.
- * XXX ^^ I think this behavior is a hold-over from back when we had only a
- * few relays in the network, and certainly back before guards existed.
- * We should very likely get rid of it. -RD
+ * to handle the desired path length, return -1.
*/
static int
new_route_len(uint8_t purpose, extend_info_t *exit, smartlist_t *nodes)
@@ -2787,19 +2783,13 @@ new_route_len(uint8_t purpose, extend_info_t *exit, smartlist_t *nodes)
log_debug(LD_CIRC,"Chosen route length %d (%d/%d routers suitable).",
routelen, num_acceptable_routers, smartlist_len(nodes));
- if (num_acceptable_routers < 2) {
+ if (num_acceptable_routers < routelen) {
log_info(LD_CIRC,
- "Not enough acceptable routers (%d). Discarding this circuit.",
- num_acceptable_routers);
+ "Not enough acceptable routers (%d/%d). Discarding this circuit.",
+ num_acceptable_routers, routelen);
return -1;
}
- if (num_acceptable_routers < routelen) {
- log_info(LD_CIRC,"Not enough routers: cutting routelen from %d to %d.",
- routelen, num_acceptable_routers);
- routelen = num_acceptable_routers;
- }
-
return routelen;
}