Merge branch 'bug2797'

This commit is contained in:
Nick Mathewson 2011-07-11 09:48:38 -04:00
commit 3799ce7970
6 changed files with 10 additions and 12 deletions

View File

@ -2693,8 +2693,7 @@ choose_good_exit_server_general(int need_uptime, int need_capacity)
n_supported[i] = -1;
continue; /* skip routers that are known to be down or bad exits */
}
if (options->_ExcludeExitNodesUnion &&
routerset_contains_node(options->_ExcludeExitNodesUnion, node)) {
if (routerset_contains_node(options->_ExcludeExitNodesUnion, node)) {
n_supported[i] = -1;
continue; /* user asked us not to use it, no matter what */
}
@ -3505,8 +3504,7 @@ entry_is_live(entry_guard_t *e, int need_uptime, int need_capacity,
return NULL;
}
}
if (options->EntryNodes &&
routerset_contains_node(options->EntryNodes, node)) {
if (routerset_contains_node(options->EntryNodes, node)) {
/* they asked for it, they get it */
need_uptime = need_capacity = 0;
}

View File

@ -3146,8 +3146,7 @@ connection_ap_can_use_exit(edge_connection_t *conn, const node_t *exit)
if (!conn->chosen_exit_name && node_exit_policy_rejects_all(exit))
return 0;
}
if (options->_ExcludeExitNodesUnion &&
routerset_contains_node(options->_ExcludeExitNodesUnion, exit)) {
if (routerset_contains_node(options->_ExcludeExitNodesUnion, exit)) {
/* Not a suitable exit. Refuse it. */
return 0;
}

View File

@ -306,7 +306,7 @@ directory_post_to_dirservers(uint8_t dir_purpose, uint8_t router_purpose,
if (exclude_self && router_digest_is_me(ds->digest))
continue;
if (options->ExcludeNodes && options->StrictNodes &&
if (options->StrictNodes &&
routerset_contains_routerstatus(options->ExcludeNodes, rs, -1)) {
log_warn(LD_DIR, "Wanted to contact authority '%s' for %s, but "
"it's in our ExcludedNodes list and StrictNodes is set. "

View File

@ -948,7 +948,7 @@ rend_client_get_random_intro_impl(const rend_cache_entry_t *entry,
intro->extend_info = extend_info_from_node(node);
}
/* Check if we should refuse to talk to this router. */
if (options->ExcludeNodes && strict &&
if (strict &&
routerset_contains_extendinfo(options->ExcludeNodes,
intro->extend_info)) {
n_excluded++;

View File

@ -1079,7 +1079,7 @@ rend_service_introduce(origin_circuit_t *circuit, const uint8_t *request,
}
/* Check if we'd refuse to talk to this router */
if (options->ExcludeNodes && options->StrictNodes &&
if (options->StrictNodes &&
routerset_contains_extendinfo(options->ExcludeNodes, extend_info)) {
log_warn(LD_REND, "Client asked to rendezvous at a relay that we "
"exclude, and StrictNodes is set. Refusing service.");

View File

@ -1132,7 +1132,7 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags)
if ((type & MICRODESC_DIRINFO) && !is_trusted &&
!node->rs->version_supports_microdesc_cache)
continue;
if (try_excluding && options->ExcludeNodes &&
if (try_excluding &&
routerset_contains_routerstatus(options->ExcludeNodes, status,
country)) {
++n_excluded;
@ -1237,7 +1237,7 @@ router_pick_trusteddirserver_impl(dirinfo_type_t type, int flags,
continue;
if (requireother && me && router_digest_is_me(d->digest))
continue;
if (try_excluding && options->ExcludeNodes &&
if (try_excluding &&
routerset_contains_routerstatus(options->ExcludeNodes,
&d->fake_status, -1)) {
++n_excluded;
@ -5567,7 +5567,8 @@ routerset_contains(const routerset_t *set, const tor_addr_t *addr,
const char *nickname, const char *id_digest,
country_t country)
{
if (!set || !set->list) return 0;
if (!set || !set->list)
return 0;
if (nickname && strmap_get_lc(set->names, nickname))
return 4;
if (id_digest && digestmap_get(set->digests, id_digest))