[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Merge remote-tracking branch 'public/bug7484'



commit 9b11dc36179e48bd39e57a9f3e0e26a25f50adfa
Merge: 4ac5175 ecd16ed
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Nov 12 13:44:57 2014 -0500

    Merge remote-tracking branch 'public/bug7484'
    
    Conflicts:
    	src/test/test_addr.c

 changes/bug7484      |    4 ++++
 src/common/address.c |    5 +++++
 src/test/test_addr.c |    3 +--
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --cc src/test/test_addr.c
index a254a34,7c289c3..c9c47bd
--- a/src/test/test_addr.c
+++ b/src/test/test_addr.c
@@@ -618,83 -610,81 +618,82 @@@ test_addr_ip6_helpers(void *arg
           "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:"
           "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]",
           0, &t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    /* Try some failing cases. */
    r=tor_addr_parse_mask_ports("[fefef::]/112", 0, &t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("[fefe::/112", 0, &t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("[fefe::", 0, &t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("[fefe::X]", 0, &t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("efef::/112", 0, &t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("[f:f:f:f:f:f:f:f::]",0,&t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("[::f:f:f:f:f:f:f:f]",0,&t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("[f:f:f:f:f:f:f:f:f]",0,&t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("[f:f:f:f:f::]/fred",0,&t1,&mask, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("[f:f:f:f:f::]/255.255.0.0",
                                0,&t1, NULL, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    /* This one will get rejected because it isn't a pure prefix. */
    r=tor_addr_parse_mask_ports("1.1.2.3/255.255.64.0",0,&t1, &mask,NULL,NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    /* Test for V4-mapped address with mask < 96.  (arguably not valid) */
    r=tor_addr_parse_mask_ports("[::ffff:1.1.2.2/33]",0,&t1, &mask, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("1.1.2.2/33",0,&t1, &mask, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    /* Try extended wildcard addresses with out TAPMP_EXTENDED_STAR*/
    r=tor_addr_parse_mask_ports("*4",0,&t1, &mask, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
    r=tor_addr_parse_mask_ports("*6",0,&t1, &mask, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_int_op(r, OP_EQ, -1);
- #if 0
++  tt_assert(r == -1);
    /* Try a mask with a wildcard. */
    r=tor_addr_parse_mask_ports("*/16",0,&t1, &mask, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_assert(r == -1);
    r=tor_addr_parse_mask_ports("*4/16",TAPMP_EXTENDED_STAR,
                                &t1, &mask, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_assert(r == -1);
    r=tor_addr_parse_mask_ports("*6/30",TAPMP_EXTENDED_STAR,
                                &t1, &mask, NULL, NULL);
 -  test_assert(r == -1);
 +  tt_assert(r == -1);
- #endif
    /* Basic mask tests*/
    r=tor_addr_parse_mask_ports("1.1.2.2/31",0,&t1, &mask, NULL, NULL);
 -  test_assert(r == AF_INET);
 -  tt_int_op(mask,==,31);
 -  tt_int_op(tor_addr_family(&t1),==,AF_INET);
 -  tt_int_op(tor_addr_to_ipv4h(&t1),==,0x01010202);
 +  tt_assert(r == AF_INET);
 +  tt_int_op(mask,OP_EQ,31);
 +  tt_int_op(tor_addr_family(&t1),OP_EQ,AF_INET);
 +  tt_int_op(tor_addr_to_ipv4h(&t1),OP_EQ,0x01010202);
    r=tor_addr_parse_mask_ports("3.4.16.032:1-2",0,&t1, &mask, &port1, &port2);
 -  test_assert(r == AF_INET);
 -  tt_int_op(mask,==,32);
 -  tt_int_op(tor_addr_family(&t1),==,AF_INET);
 -  tt_int_op(tor_addr_to_ipv4h(&t1),==,0x03041020);
 -  test_assert(port1 == 1);
 -  test_assert(port2 == 2);
 +  tt_assert(r == AF_INET);
 +  tt_int_op(mask,OP_EQ,32);
 +  tt_int_op(tor_addr_family(&t1),OP_EQ,AF_INET);
 +  tt_int_op(tor_addr_to_ipv4h(&t1),OP_EQ,0x03041020);
 +  tt_assert(port1 == 1);
 +  tt_assert(port2 == 2);
    r=tor_addr_parse_mask_ports("1.1.2.3/255.255.128.0",0,&t1, &mask,NULL,NULL);
 -  test_assert(r == AF_INET);
 -  tt_int_op(mask,==,17);
 -  tt_int_op(tor_addr_family(&t1),==,AF_INET);
 -  tt_int_op(tor_addr_to_ipv4h(&t1),==,0x01010203);
 +  tt_assert(r == AF_INET);
 +  tt_int_op(mask,OP_EQ,17);
 +  tt_int_op(tor_addr_family(&t1),OP_EQ,AF_INET);
 +  tt_int_op(tor_addr_to_ipv4h(&t1),OP_EQ,0x01010203);
    r=tor_addr_parse_mask_ports("[efef::]/112",0,&t1, &mask, &port1, &port2);
 -  test_assert(r == AF_INET6);
 -  test_assert(port1 == 1);
 -  test_assert(port2 == 65535);
 +  tt_assert(r == AF_INET6);
 +  tt_assert(port1 == 1);
 +  tt_assert(port2 == 65535);
    /* Try regular wildcard behavior without TAPMP_EXTENDED_STAR */
    r=tor_addr_parse_mask_ports("*:80-443",0,&t1,&mask,&port1,&port2);
 -  tt_int_op(r,==,AF_INET); /* Old users of this always get inet */
 -  tt_int_op(tor_addr_family(&t1),==,AF_INET);
 -  tt_int_op(tor_addr_to_ipv4h(&t1),==,0);
 -  tt_int_op(mask,==,0);
 -  tt_int_op(port1,==,80);
 -  tt_int_op(port2,==,443);
 +  tt_int_op(r,OP_EQ,AF_INET); /* Old users of this always get inet */
 +  tt_int_op(tor_addr_family(&t1),OP_EQ,AF_INET);
 +  tt_int_op(tor_addr_to_ipv4h(&t1),OP_EQ,0);
 +  tt_int_op(mask,OP_EQ,0);
 +  tt_int_op(port1,OP_EQ,80);
 +  tt_int_op(port2,OP_EQ,443);
    /* Now try wildcards *with* TAPMP_EXTENDED_STAR */
    r=tor_addr_parse_mask_ports("*:8000-9000",TAPMP_EXTENDED_STAR,
                                &t1,&mask,&port1,&port2);

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits