aboutsummaryrefslogtreecommitdiff
path: root/src/or/policies.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-10-13 20:30:40 -0400
committerNick Mathewson <nickm@torproject.org>2010-10-13 20:30:40 -0400
commit44674369c5db15f64c7b5fe53c3b7010abb783d5 (patch)
tree5e4ab85f2263b3980e27b7331db98371742b2b65 /src/or/policies.c
parent3aec6556941433e4770226530457eb79a511b555 (diff)
downloadtor-44674369c5db15f64c7b5fe53c3b7010abb783d5.tar.gz
tor-44674369c5db15f64c7b5fe53c3b7010abb783d5.zip
Implement node_set_exit_policy_to_reject_all with a flag
Also remove some debugging code.
Diffstat (limited to 'src/or/policies.c')
-rw-r--r--src/or/policies.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/or/policies.c b/src/or/policies.c
index 2ae66df5e9..f20fe79468 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -875,25 +875,11 @@ policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
return 0;
}
-#if 0
-/** Replace the exit policy of <b>r</b> with reject *:*. */
-void
-policies_set_router_exitpolicy_to_reject_all(routerinfo_t *r)
-{
- addr_policy_t *item;
- addr_policy_list_free(r->exit_policy);
- r->exit_policy = smartlist_create();
- item = router_parse_addr_policy_item_from_string("reject *:*", -1);
- smartlist_add(r->exit_policy, item);
-}
-#endif
-
/** Replace the exit policy of <b>node</b> with reject *:* */
void
policies_set_node_exitpolicy_to_reject_all(node_t *node)
{
- (void)node;
- UNIMPLEMENTED_NODELIST();
+ node->rejects_all = 1;
}
/** Return 1 if there is at least one /8 subnet in <b>policy</b> that
@@ -1488,6 +1474,9 @@ addr_policy_result_t
compare_tor_addr_to_node_policy(const tor_addr_t *addr, uint16_t port,
const node_t *node)
{
+ if (node->rejects_all)
+ return ADDR_POLICY_REJECTED;
+
if (node->ri)
return compare_tor_addr_to_addr_policy(addr, port, node->ri->exit_policy);
else if (node->md && node->md) {