]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge branch 'bug8197_squashed'
authorNick Mathewson <nickm@torproject.org>
Mon, 22 Sep 2014 18:34:52 +0000 (14:34 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 22 Sep 2014 18:34:52 +0000 (14:34 -0400)
Conflicts:
src/test/test_policy.c

1  2 
src/test/test_policy.c

index 61a5449c159214637f9a735ac908c5734055bff7,f1196c255e274a2111baa6aea9c461a096159f98..388251a61f05cb4a487b66344cce21a8aa68c4fe
@@@ -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);
    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 */