aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-11-24 06:43:39 +0000
committerRoger Dingledine <arma@torproject.org>2005-11-24 06:43:39 +0000
commitea7fe0c2674f4b10d8a9571c7d61844fb18d7f45 (patch)
tree7af9da4d74bbd43437533893470d0ebc1321cafa /src/or
parent5b583073a1ad308ec1ca3114854345a1890f4185 (diff)
downloadtor-ea7fe0c2674f4b10d8a9571c7d61844fb18d7f45.tar
tor-ea7fe0c2674f4b10d8a9571c7d61844fb18d7f45.tar.gz
Fix a bug found by Lasse Overlier: when we were making internal circuits
(intended to be cannibalized later for rendezvous and introduction circuits), we were picking them so that they had useful exit nodes. There was no need for this, and it actually aids some statistical attacks. svn:r5453
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitbuild.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 9e542bd51..eabd4edc5 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1244,13 +1244,18 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
*/
static routerinfo_t *
choose_good_exit_server(uint8_t purpose, routerlist_t *dir,
- int need_uptime, int need_capacity)
+ int need_uptime, int need_capacity, int is_internal)
{
routerinfo_t *r;
or_options_t *options = get_options();
switch (purpose) {
case CIRCUIT_PURPOSE_C_GENERAL:
- return choose_good_exit_server_general(dir, need_uptime, need_capacity);
+ if (is_internal) /* pick it like a middle hop */
+ return router_choose_random_node(NULL, get_options()->ExcludeNodes,
+ NULL, need_uptime, need_capacity,
+ get_options()->_AllowUnverified & ALLOW_UNVERIFIED_MIDDLE, 0);
+ else
+ return choose_good_exit_server_general(dir, need_uptime, need_capacity);
case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
r = router_choose_random_node(options->RendNodes, options->RendExcludeNodes,
NULL, need_uptime, need_capacity,
@@ -1283,8 +1288,8 @@ onion_pick_cpath_exit(circuit_t *circ, extend_info_t *exit)
exit = extend_info_dup(exit);
} else { /* we have to decide one */
routerinfo_t *router =
- choose_good_exit_server(circ->purpose, rl,
- state->need_uptime, state->need_capacity);
+ choose_good_exit_server(circ->purpose, rl, state->need_uptime,
+ state->need_capacity, state->is_internal);
if (!router) {
warn(LD_CIRC,"failed to choose an exit server");
return -1;