[tor-commits] [tor/master] use me->addr when adding our address to our exit policy
nickm at torproject.org
nickm at torproject.org
Wed Mar 5 17:44:53 UTC 2014
commit 002c860caee374688f9478dfd6a6e2ebddad791f
Author: Roger Dingledine <arma at torproject.org>
Date: Sat Feb 9 21:17:44 2013 -0500
use me->addr when adding our address to our exit policy
(rather than me->address)
---
src/or/policies.c | 6 +++---
src/or/policies.h | 2 +-
src/or/router.c | 2 +-
src/test/test.c | 6 +++---
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/or/policies.c b/src/or/policies.c
index 9696b81..a658fae 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -438,7 +438,7 @@ validate_addr_policies(const or_options_t *options, char **msg)
if (policies_parse_exit_policy(options->ExitPolicy, &addr_policy,
options->IPv6Exit,
- options->ExitPolicyRejectPrivate, NULL,
+ options->ExitPolicyRejectPrivate, 0,
!options->BridgeRelay))
REJECT("Error in ExitPolicy entry.");
@@ -940,7 +940,7 @@ exit_policy_remove_redundancies(smartlist_t *dest)
int
policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
int ipv6_exit,
- int rejectprivate, const char *local_address,
+ int rejectprivate, uint32_t local_address,
int add_default_policy)
{
if (!ipv6_exit) {
@@ -950,7 +950,7 @@ policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
append_exit_policy_string(dest, "reject private:*");
if (local_address) {
char buf[POLICY_BUF_LEN];
- tor_snprintf(buf, sizeof(buf), "reject %s:*", local_address);
+ tor_snprintf(buf, sizeof(buf), "reject %s:*", fmt_addr32(local_address));
append_exit_policy_string(dest, buf);
}
}
diff --git a/src/or/policies.h b/src/or/policies.h
index da375c4..d8df567 100644
--- a/src/or/policies.h
+++ b/src/or/policies.h
@@ -44,7 +44,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 ipv6exit,
- int rejectprivate, const char *local_address,
+ int rejectprivate, uint32_t 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);
diff --git a/src/or/router.c b/src/or/router.c
index 9382fdd..c7932d1 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1824,7 +1824,7 @@ router_rebuild_descriptor(int force)
policies_parse_exit_policy(options->ExitPolicy, &ri->exit_policy,
options->IPv6Exit,
options->ExitPolicyRejectPrivate,
- ri->address, !options->BridgeRelay);
+ ri->addr, !options->BridgeRelay);
}
ri->policy_is_reject_star =
policy_is_reject_star(ri->exit_policy, AF_INET) &&
diff --git a/src/test/test.c b/src/test/test.c
index b838172..5b2c7bd 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -1102,7 +1102,7 @@ test_policy_summary_helper(const char *policy_str,
line.value = (char *)policy_str;
line.next = NULL;
- r = policies_parse_exit_policy(&line, &policy, 1, 0, NULL, 1);
+ r = policies_parse_exit_policy(&line, &policy, 1, 0, 0, 1);
test_eq(r, 0);
summary = policy_summarize(policy, AF_INET);
@@ -1159,7 +1159,7 @@ test_policies(void)
test_assert(ADDR_POLICY_REJECTED ==
compare_tor_addr_to_addr_policy(&tar, 2, policy));
- test_assert(0 == policies_parse_exit_policy(NULL, &policy2, 1, 1, NULL, 1));
+ test_assert(0 == policies_parse_exit_policy(NULL, &policy2, 1, 1, 0, 1));
test_assert(policy2);
policy3 = smartlist_new();
@@ -1246,7 +1246,7 @@ test_policies(void)
line.key = (char*)"foo";
line.value = (char*)"accept *:80,reject private:*,reject *:*";
line.next = NULL;
- test_assert(0 == policies_parse_exit_policy(&line, &policy, 1, 0, NULL, 1));
+ test_assert(0 == policies_parse_exit_policy(&line, &policy, 1, 0, 0, 1));
test_assert(policy);
//test_streq(policy->string, "accept *:80");
//test_streq(policy->next->string, "reject *:*");
More information about the tor-commits
mailing list