[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #2366 [Tor Relay]: Sync relay's policy with published descriptor.
#2366: Sync relay's policy with published descriptor.
---------------------+------------------------------------------------------
Reporter: postman | Type: defect
Status: new | Priority: normal
Milestone: | Component: Tor Relay
Version: | Keywords: dns reject policy
Parent: |
---------------------+------------------------------------------------------
Comment(by postman):
Extended of extended of extended version:
{{{
--- policies.h.origin Mon Jan 3 22:25:30 2011
+++ policies.h Sun Jan 9 18:46:58 2011
@@ -48,6 +48,7 @@
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);
--- policies.c.origin Mon Jan 3 22:25:30 2011
+++ policies.c Sun Jan 9 18:53:18 2011
@@ -875,6 +875,13 @@
return 0;
}
+/** DOC */
+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)
--- router.c.origin Mon Jan 3 22:25:30 2011
+++ router.c Sun Jan 9 18:48:06 2011
@@ -1411,9 +1411,14 @@
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 @@
}
/* 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;
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/2366#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs