[tor-commits] [tor/master] Merge branch 'bug8197_squashed'
nickm at torproject.org
nickm at torproject.org
Mon Sep 22 18:35:21 UTC 2014
commit bdd0c77643dfc5b3c5084a0f4dc53de393362796
Merge: c8d927b 80622c0
Author: Nick Mathewson <nickm at torproject.org>
Date: Mon Sep 22 14:34:52 2014 -0400
Merge branch 'bug8197_squashed'
Conflicts:
src/test/test_policy.c
changes/bug8197 | 6 ++++
src/or/policies.c | 86 +++++++++++++++++++++++++++++++++++++++++++-----
src/or/policies.h | 14 ++++++++
src/or/router.c | 6 ++--
src/test/test_policy.c | 16 +++++++--
5 files changed, 112 insertions(+), 16 deletions(-)
diff --cc src/test/test_policy.c
index 61a5449,f1196c2..388251a
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@@ -47,12 -47,14 +47,15 @@@ test_policy_summary_helper(const char *
line.value = (char *)policy_str;
line.next = NULL;
- r = policies_parse_exit_policy(&line, &policy, 1, 0, 0, 1);
+ r = policies_parse_exit_policy(&line, &policy,
+ EXIT_POLICY_IPV6_ENABLED |
+ EXIT_POLICY_ADD_DEFAULT ,0);
- test_eq(r, 0);
+ tt_int_op(r,==, 0);
++
summary = policy_summarize(policy, AF_INET);
- test_assert(summary != NULL);
- test_streq(summary, expected_summary);
+ tt_assert(summary != NULL);
+ tt_str_op(summary,==, expected_summary);
short_policy = parse_short_policy(summary);
tt_assert(short_policy);
@@@ -97,17 -99,21 +100,21 @@@ test_policies_general(void *arg
smartlist_add(policy, p);
tor_addr_from_ipv4h(&tar, 0x01020304u);
- test_assert(ADDR_POLICY_ACCEPTED ==
+ tt_assert(ADDR_POLICY_ACCEPTED ==
compare_tor_addr_to_addr_policy(&tar, 2, policy));
tor_addr_make_unspec(&tar);
- test_assert(ADDR_POLICY_PROBABLY_ACCEPTED ==
+ tt_assert(ADDR_POLICY_PROBABLY_ACCEPTED ==
compare_tor_addr_to_addr_policy(&tar, 2, policy));
tor_addr_from_ipv4h(&tar, 0xc0a80102);
- test_assert(ADDR_POLICY_REJECTED ==
+ tt_assert(ADDR_POLICY_REJECTED ==
compare_tor_addr_to_addr_policy(&tar, 2, policy));
- tt_assert(0 == policies_parse_exit_policy(NULL, &policy2, 1, 1, 0, 1));
- test_assert(0 == policies_parse_exit_policy(NULL, &policy2,
++ tt_int_op(0, ==, policies_parse_exit_policy(NULL, &policy2,
+ EXIT_POLICY_IPV6_ENABLED |
+ EXIT_POLICY_REJECT_PRIVATE |
+ EXIT_POLICY_ADD_DEFAULT, 0));
+
- test_assert(policy2);
+ tt_assert(policy2);
policy3 = smartlist_new();
p = router_parse_addr_policy_item_from_string("reject *:*",-1);
@@@ -193,11 -199,14 +200,14 @@@
line.key = (char*)"foo";
line.value = (char*)"accept *:80,reject private:*,reject *:*";
line.next = NULL;
- tt_assert(0 == policies_parse_exit_policy(&line, &policy, 1, 0, 0, 1));
-
- test_assert(0 == policies_parse_exit_policy(&line,&policy,
++ tt_int_op(0, ==, policies_parse_exit_policy(&line,&policy,
+ EXIT_POLICY_IPV6_ENABLED |
+ EXIT_POLICY_ADD_DEFAULT,0));
- test_assert(policy);
+ tt_assert(policy);
++
//test_streq(policy->string, "accept *:80");
//test_streq(policy->next->string, "reject *:*");
- test_eq(smartlist_len(policy), 4);
+ tt_int_op(smartlist_len(policy),==, 4);
/* test policy summaries */
/* check if we properly ignore private IP addresses */
More information about the tor-commits
mailing list