diff options
author | Roger Dingledine <arma@torproject.org> | 2009-10-17 18:54:20 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-04-26 23:53:49 -0400 |
commit | ad3da535366aeb9b7441f4881899758bc7475168 (patch) | |
tree | 90de3a8a4f1a5d8bd204b9afdf717b979e30792e /src/or/routerlist.c | |
parent | 82178a81f6748c9b26bdc8a5da36dd34b689281b (diff) | |
download | tor-ad3da535366aeb9b7441f4881899758bc7475168.tar.gz tor-ad3da535366aeb9b7441f4881899758bc7475168.zip |
If EntryNodes and ExcludeNodes overlap, obey ExcludeNodes.
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index c02654feef..5d9ab8cbac 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -5516,10 +5516,11 @@ routerset_contains_routerstatus(const routerset_t *set, routerstatus_t *rs) } /** Add every known routerinfo_t that is a member of <b>routerset</b> to - * <b>out</b>. If <b>running_only</b>, only add the running ones. */ + * <b>out</b>, but never add any that are part of <b>excludeset</b>. + * If <b>running_only</b>, only add the running ones. */ void routerset_get_all_routers(smartlist_t *out, const routerset_t *routerset, - int running_only) + const routerset_t *excludeset, int running_only) { tor_assert(out); if (!routerset || !routerset->list) @@ -5529,12 +5530,13 @@ routerset_get_all_routers(smartlist_t *out, const routerset_t *routerset, if (routerset_is_list(routerset)) { /* No routers are specified by type; all are given by name or digest. - * we can do a lookup in O(len(list)). */ + * we can do a lookup in O(len(routerset)). */ SMARTLIST_FOREACH(routerset->list, const char *, name, { routerinfo_t *router = router_get_by_nickname(name, 1); if (router) { if (!running_only || router->is_running) - smartlist_add(out, router); + if (!routerset_contains_router(excludeset, router)) + smartlist_add(out, router); } }); } else { @@ -5544,7 +5546,8 @@ routerset_get_all_routers(smartlist_t *out, const routerset_t *routerset, SMARTLIST_FOREACH(rl->routers, routerinfo_t *, router, { if (running_only && !router->is_running) continue; - if (routerset_contains_router(routerset, router)) + if (routerset_contains_router(routerset, router) && + !routerset_contains_router(excludeset, router)) smartlist_add(out, router); }); } |