diff options
author | teor (Tim Wilson-Brown) <teor2345@gmail.com> | 2016-04-28 15:40:04 +1000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-05-05 08:16:28 -0400 |
commit | 88deb52d559fbec17be4a634137ac4b6c207ce06 (patch) | |
tree | acf34c387832aaf0553e023938a2c28c39eec1bf | |
parent | 833b5f71a72394c02ef633ba0f78d7011fef6181 (diff) | |
download | tor-88deb52d559fbec17be4a634137ac4b6c207ce06.tar.gz tor-88deb52d559fbec17be4a634137ac4b6c207ce06.zip |
Make clients only select directories with reachable ORPorts
This makes sure clients will only select relays which support
begindir over ORPort.
-rw-r--r-- | src/or/routerlist.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 3c9023e8f0..6a293b7ccb 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1689,6 +1689,7 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags, const int skip_or = router_skip_or_reachability(options, try_ip_pref); const int skip_dir = router_skip_dir_reachability(options, try_ip_pref); + const int must_have_or = directory_must_use_begindir(options); /* Find all the running dirservers we know about. */ SMARTLIST_FOREACH_BEGIN(nodelist_get_list(), const node_t *, node) { @@ -1745,9 +1746,9 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags, try_ip_pref)) smartlist_add(is_trusted ? trusted_tunnel : is_overloaded ? overloaded_tunnel : tunnel, (void*)node); - else if (skip_dir || + else if (!must_have_or && (skip_dir || fascist_firewall_allows_rs(status, FIREWALL_DIR_CONNECTION, - try_ip_pref)) + try_ip_pref))) smartlist_add(is_trusted ? trusted_direct : is_overloaded ? overloaded_direct : direct, (void*)node); else if (!tor_addr_is_null(&status->ipv6_addr)) @@ -1853,6 +1854,7 @@ router_pick_trusteddirserver_impl(const smartlist_t *sourcelist, const int skip_or = router_skip_or_reachability(options, try_ip_pref); const int skip_dir = router_skip_dir_reachability(options, try_ip_pref); + const int must_have_or = directory_must_use_begindir(options); SMARTLIST_FOREACH_BEGIN(sourcelist, const dir_server_t *, d) { @@ -1892,9 +1894,9 @@ router_pick_trusteddirserver_impl(const smartlist_t *sourcelist, fascist_firewall_allows_dir_server(d, FIREWALL_OR_CONNECTION, try_ip_pref)) smartlist_add(is_overloaded ? overloaded_tunnel : tunnel, (void*)d); - else if (skip_dir || + else if (!must_have_or && (skip_dir || fascist_firewall_allows_dir_server(d, FIREWALL_DIR_CONNECTION, - try_ip_pref)) + try_ip_pref))) smartlist_add(is_overloaded ? overloaded_direct : direct, (void*)d); else if (!tor_addr_is_null(&d->ipv6_addr)) ++n_not_preferred; |