diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-02-22 14:10:42 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-02-22 14:10:42 -0500 |
commit | b7f201f74606aff1f77551449bebe8783a59733a (patch) | |
tree | 70ac808a443977ca797e24dafcbda2705e9e9e4f /src | |
parent | 46b07462ae636eae1e241d5596b3a1d80c82d7ef (diff) | |
parent | cdc59c198a15195a113d68b2c4fbb270792da533 (diff) | |
download | tor-b7f201f74606aff1f77551449bebe8783a59733a.tar.gz tor-b7f201f74606aff1f77551449bebe8783a59733a.zip |
Merge remote branch 'origin/maint-0.2.2'
Conflicts:
src/or/policies.c
src/or/policies.h
Diffstat (limited to 'src')
-rw-r--r-- | src/or/policies.c | 8 | ||||
-rw-r--r-- | src/or/policies.h | 1 | ||||
-rw-r--r-- | src/or/router.c | 15 |
3 files changed, 18 insertions, 6 deletions
diff --git a/src/or/policies.c b/src/or/policies.c index d0406d3889..2cf99820b1 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -875,6 +875,14 @@ policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest, return 0; } +/** Add "reject *:*" to the end of the policy in *<b>dest</b>, allocating + * *<b>dest</b> as needed. */ +void +policies_exit_policy_append_reject_star(smartlist_t **dest) +{ + append_exit_policy_string(dest, "reject *:*"); +} + /** Replace the exit policy of <b>node</b> with reject *:* */ void policies_set_node_exitpolicy_to_reject_all(node_t *node) diff --git a/src/or/policies.h b/src/or/policies.h index 371123c1e8..ee1162ccc2 100644 --- a/src/or/policies.h +++ b/src/or/policies.h @@ -48,6 +48,7 @@ addr_policy_result_t compare_tor_addr_to_node_policy(const tor_addr_t *addr, int policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest, int rejectprivate, const char *local_address, int add_default_policy); +void policies_exit_policy_append_reject_star(smartlist_t **dest); void policies_set_node_exitpolicy_to_reject_all(node_t *exitrouter); int exit_policy_is_general_exit(smartlist_t *policy); int policy_is_reject_star(const smartlist_t *policy); diff --git a/src/or/router.c b/src/or/router.c index ed998e444f..3f1a0a0e02 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1411,9 +1411,14 @@ router_rebuild_descriptor(int force) ri->bandwidthcapacity = hibernating ? 0 : rep_hist_bandwidth_assess(); - policies_parse_exit_policy(options->ExitPolicy, &ri->exit_policy, - options->ExitPolicyRejectPrivate, - ri->address, !options->BridgeRelay); + if (dns_seems_to_be_broken() || has_dns_init_failed()) { + /* DNS is screwed up; don't claim to be an exit. */ + policies_exit_policy_append_reject_star(&ri->exit_policy); + } else { + policies_parse_exit_policy(options->ExitPolicy, &ri->exit_policy, + options->ExitPolicyRejectPrivate, + ri->address, !options->BridgeRelay); + } ri->policy_is_reject_star = policy_is_reject_star(ri->exit_policy); @@ -1865,9 +1870,7 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, } /* Write the exit policy to the end of 's'. */ - if (dns_seems_to_be_broken() || has_dns_init_failed() || - !router->exit_policy || !smartlist_len(router->exit_policy)) { - /* DNS is screwed up; don't claim to be an exit. */ + if (!router->exit_policy || !smartlist_len(router->exit_policy)) { strlcat(s+written, "reject *:*\n", maxlen-written); written += strlen("reject *:*\n"); tmpe = NULL; |