diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-02-22 14:06:28 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-02-22 14:06:28 -0500 |
commit | cdc59c198a15195a113d68b2c4fbb270792da533 (patch) | |
tree | a203f0f49552aaf0b7840534eed3151ff3840708 /src/or/router.c | |
parent | 9d5873cdaedf5bbae50bec08bb0719a1a5be403d (diff) | |
download | tor-cdc59c198a15195a113d68b2c4fbb270792da533.tar tor-cdc59c198a15195a113d68b2c4fbb270792da533.tar.gz |
Don't let bad DNS make exit policy and declared exit policy get out of sync
Patch from "postman" on trac. Fixes bg 2366. Bug on 0.1.2.5-alpha.
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/or/router.c b/src/or/router.c index 59276bac3..4c5eb7a39 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1410,9 +1410,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); @@ -1866,9 +1871,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; |