summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/or/main.c3
-rw-r--r--src/or/nodelist.c8
-rw-r--r--src/or/nodelist.h7
-rw-r--r--src/or/or.h3
-rw-r--r--src/or/policies.c19
5 files changed, 12 insertions, 28 deletions
diff --git a/src/or/main.c b/src/or/main.c
index a4d0c904fa..9d116fba8a 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1044,7 +1044,7 @@ run_scheduled_events(time_t now)
*/
consider_hibernation(now);
- /* XXXX NM REMOVE THIS. XXXX NM XXXX NM XXXX NM*/
+#if 0
{
static time_t nl_check_time = 0;
if (nl_check_time <= now) {
@@ -1052,6 +1052,7 @@ run_scheduled_events(time_t now)
nl_check_time = now + 30;
}
}
+#endif
/* 0b. If we've deferred a signewnym, make sure it gets handled
* eventually. */
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 8145217c2f..d1246679a5 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -605,6 +605,9 @@ node_allows_single_hop_exits(const node_t *node)
int
node_exit_policy_rejects_all(const node_t *node)
{
+ if (node->rejects_all)
+ return 1;
+
if (node->ri)
return node->ri->policy_is_reject_star;
else if (node->md)
@@ -723,8 +726,3 @@ node_get_declared_family(const node_t *node)
else
return NULL;
}
-
-/* KILLTHIS XXXX NM -- it's a dummy to keep UNIMPLEMENTED_NODELIST()
- * working */
-int unimplemented_nodelist_truth = 1;
-
diff --git a/src/or/nodelist.h b/src/or/nodelist.h
index cb78366508..23f4a16427 100644
--- a/src/or/nodelist.h
+++ b/src/or/nodelist.h
@@ -55,12 +55,5 @@ void node_set_country(node_t *node);
void nodelist_add_node_family(smartlist_t *nodes, const node_t *node);
int nodes_in_same_family(const node_t *node1, const node_t *node2);
-/* This means: implement this code or function or thing, nick! */
-#define UNIMPLEMENTED_NODELIST() \
- while (unimplemented_nodelist_truth) { \
- tor_assert(0); \
- }
-extern int unimplemented_nodelist_truth;
-
#endif
diff --git a/src/or/or.h b/src/or/or.h
index 96d0d79e1a..eadc3b13f5 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1768,6 +1768,9 @@ typedef struct node_t {
* to this (unnamed) router by nickname?
*/
+ /** Local info: we treat this node as if it rejects everything */
+ unsigned int rejects_all:1;
+
/* Local info: derived. */
/** According to the geoip db what country is this router in? */
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) {