diff options
author | Roger Dingledine <arma@torproject.org> | 2008-02-04 17:25:24 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-02-04 17:25:24 +0000 |
commit | fdbefc89342c7a6cefc3feba8ada5107ddbe34df (patch) | |
tree | 1fe9b50bad69051860dc437a038e49da053a5ac9 /src | |
parent | 426a9bbde18046ad021fbfc5b38383ce18d5c798 (diff) | |
download | tor-fdbefc89342c7a6cefc3feba8ada5107ddbe34df.tar.gz tor-fdbefc89342c7a6cefc3feba8ada5107ddbe34df.zip |
If we're a relay, avoid picking ourselves as an introduction point,
a rendezvous point, or as the final hop for internal circuits. Bug
reported by taranis and lodger. Bugfix on 0.1.2.x.
svn:r13372
Diffstat (limited to 'src')
-rw-r--r-- | src/or/circuitbuild.c | 8 | ||||
-rw-r--r-- | src/or/routerlist.c | 7 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 4f57922160..785926b09b 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1577,10 +1577,6 @@ choose_good_middle_server(uint8_t purpose, smartlist_add(excluded, r); routerlist_add_family(excluded, r); } - if ((r = routerlist_find_my_routerinfo())) { - smartlist_add(excluded, r); - routerlist_add_family(excluded, r); - } for (i = 0, cpath = head; i < cur_len; ++i, cpath=cpath->next) { if ((r = router_get_by_digest(cpath->extend_info->identity_digest))) { smartlist_add(excluded, r); @@ -1624,10 +1620,6 @@ choose_good_entry_server(uint8_t purpose, cpath_build_state_t *state) smartlist_add(excluded, r); routerlist_add_family(excluded, r); } - if ((r = routerlist_find_my_routerinfo())) { - smartlist_add(excluded, r); - routerlist_add_family(excluded, r); - } if (firewall_is_fascist_or()) { /* exclude all ORs that listen on the wrong port */ routerlist_t *rl = router_get_routerlist(); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 5a347ae4f8..c0d2aaac5f 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1659,7 +1659,7 @@ router_choose_random_node(const char *preferred, int weight_for_exit) { smartlist_t *sl, *excludednodes; - routerinfo_t *choice = NULL; + routerinfo_t *choice = NULL, *r; bandwidth_weight_rule_t rule; tor_assert(!(weight_for_exit && need_guard)); @@ -1669,6 +1669,11 @@ router_choose_random_node(const char *preferred, excludednodes = smartlist_create(); add_nickname_list_to_smartlist(excludednodes,excluded,0); + if ((r = routerlist_find_my_routerinfo())) { + smartlist_add(excludednodes, r); + routerlist_add_family(excludednodes, r); + } + /* Try the preferred nodes first. Ignore need_uptime and need_capacity * and need_guard, since the user explicitly asked for these nodes. */ if (preferred) { |