mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-01 08:03:31 +01:00
use me->addr when adding our address to our exit policy
(rather than me->address)
This commit is contained in:
parent
e1ec03f819
commit
002c860cae
@ -438,7 +438,7 @@ validate_addr_policies(const or_options_t *options, char **msg)
|
|||||||
|
|
||||||
if (policies_parse_exit_policy(options->ExitPolicy, &addr_policy,
|
if (policies_parse_exit_policy(options->ExitPolicy, &addr_policy,
|
||||||
options->IPv6Exit,
|
options->IPv6Exit,
|
||||||
options->ExitPolicyRejectPrivate, NULL,
|
options->ExitPolicyRejectPrivate, 0,
|
||||||
!options->BridgeRelay))
|
!options->BridgeRelay))
|
||||||
REJECT("Error in ExitPolicy entry.");
|
REJECT("Error in ExitPolicy entry.");
|
||||||
|
|
||||||
@ -940,7 +940,7 @@ exit_policy_remove_redundancies(smartlist_t *dest)
|
|||||||
int
|
int
|
||||||
policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
|
policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
|
||||||
int ipv6_exit,
|
int ipv6_exit,
|
||||||
int rejectprivate, const char *local_address,
|
int rejectprivate, uint32_t local_address,
|
||||||
int add_default_policy)
|
int add_default_policy)
|
||||||
{
|
{
|
||||||
if (!ipv6_exit) {
|
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:*");
|
append_exit_policy_string(dest, "reject private:*");
|
||||||
if (local_address) {
|
if (local_address) {
|
||||||
char buf[POLICY_BUF_LEN];
|
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);
|
append_exit_policy_string(dest, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
|
||||||
int ipv6exit,
|
int ipv6exit,
|
||||||
int rejectprivate, const char *local_address,
|
int rejectprivate, uint32_t local_address,
|
||||||
int add_default_policy);
|
int add_default_policy);
|
||||||
void policies_exit_policy_append_reject_star(smartlist_t **dest);
|
void policies_exit_policy_append_reject_star(smartlist_t **dest);
|
||||||
void policies_set_node_exitpolicy_to_reject_all(node_t *exitrouter);
|
void policies_set_node_exitpolicy_to_reject_all(node_t *exitrouter);
|
||||||
|
@ -1824,7 +1824,7 @@ router_rebuild_descriptor(int force)
|
|||||||
policies_parse_exit_policy(options->ExitPolicy, &ri->exit_policy,
|
policies_parse_exit_policy(options->ExitPolicy, &ri->exit_policy,
|
||||||
options->IPv6Exit,
|
options->IPv6Exit,
|
||||||
options->ExitPolicyRejectPrivate,
|
options->ExitPolicyRejectPrivate,
|
||||||
ri->address, !options->BridgeRelay);
|
ri->addr, !options->BridgeRelay);
|
||||||
}
|
}
|
||||||
ri->policy_is_reject_star =
|
ri->policy_is_reject_star =
|
||||||
policy_is_reject_star(ri->exit_policy, AF_INET) &&
|
policy_is_reject_star(ri->exit_policy, AF_INET) &&
|
||||||
|
@ -1102,7 +1102,7 @@ test_policy_summary_helper(const char *policy_str,
|
|||||||
line.value = (char *)policy_str;
|
line.value = (char *)policy_str;
|
||||||
line.next = NULL;
|
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);
|
test_eq(r, 0);
|
||||||
summary = policy_summarize(policy, AF_INET);
|
summary = policy_summarize(policy, AF_INET);
|
||||||
|
|
||||||
@ -1159,7 +1159,7 @@ test_policies(void)
|
|||||||
test_assert(ADDR_POLICY_REJECTED ==
|
test_assert(ADDR_POLICY_REJECTED ==
|
||||||
compare_tor_addr_to_addr_policy(&tar, 2, policy));
|
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);
|
test_assert(policy2);
|
||||||
|
|
||||||
policy3 = smartlist_new();
|
policy3 = smartlist_new();
|
||||||
@ -1246,7 +1246,7 @@ test_policies(void)
|
|||||||
line.key = (char*)"foo";
|
line.key = (char*)"foo";
|
||||||
line.value = (char*)"accept *:80,reject private:*,reject *:*";
|
line.value = (char*)"accept *:80,reject private:*,reject *:*";
|
||||||
line.next = NULL;
|
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_assert(policy);
|
||||||
//test_streq(policy->string, "accept *:80");
|
//test_streq(policy->string, "accept *:80");
|
||||||
//test_streq(policy->next->string, "reject *:*");
|
//test_streq(policy->next->string, "reject *:*");
|
||||||
|
Loading…
Reference in New Issue
Block a user