mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Implement node_set_exit_policy_to_reject_all with a flag
Also remove some debugging code.
This commit is contained in:
parent
3aec655694
commit
44674369c5
@ -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. */
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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? */
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user