summaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-12-04 05:19:56 +0000
committerNick Mathewson <nickm@torproject.org>2007-12-04 05:19:56 +0000
commit593ab7e808155fb187a6d99d9a607639502ee5b3 (patch)
treed7917a9b345a197a5d818f6adf614d5d1d55a4e6 /src/or/test.c
parentce2cf88ebf9fdc96dad1ba552c1c2904937fc1b4 (diff)
downloadtor-593ab7e808155fb187a6d99d9a607639502ee5b3.tar.gz
tor-593ab7e808155fb187a6d99d9a607639502ee5b3.zip
r15106@tombo: nickm | 2007-12-04 00:08:35 -0500
Change tor_addr_t to be a tagged union of in_addr and in6_addr, not of sockaddr_in and sockaddr_in6. It's hardly used in the main code as it is, but let's get it right before it gets popular. svn:r12660
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/or/test.c b/src/or/test.c
index 0cabd71355..b3d6730116 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -1074,38 +1074,38 @@ _test_eq_ip6(struct in6_addr *a, struct in6_addr *b, const char *e1,
/*XXXX020 make this macro give useful output on failure, and follow the
* conventions of the other test macros. */
#define test_internal_ip(a,b) STMT_BEGIN \
- r = tor_inet_pton(AF_INET6, a, &t1.sa6.sin6_addr); \
+ r = tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr); \
test_assert(r==1); \
- t1.sa6.sin6_family = AF_INET6; \
+ t1.family = AF_INET6; \
r = tor_addr_is_internal(&t1, b); \
test_assert(r==1); \
STMT_END
/*XXXX020 make this macro give useful output on failure, and follow the
* conventions of the other test macros. */
-#define test_external_ip(a,b) STMT_BEGIN \
- r = tor_inet_pton(AF_INET6, a, &t1.sa6.sin6_addr); \
- test_assert(r==1); \
- t1.sa6.sin6_family = AF_INET6; \
- r = tor_addr_is_internal(&t1, b); \
- test_assert(r==0); \
+#define test_external_ip(a,b) STMT_BEGIN \
+ r = tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr); \
+ test_assert(r==1); \
+ t1.family = AF_INET6; \
+ r = tor_addr_is_internal(&t1, b); \
+ test_assert(r==0); \
STMT_END
/*XXXX020 make this macro give useful output on failure, and follow the
* conventions of the other test macros. */
#define test_addr_convert6(a,b) STMT_BEGIN \
- tor_inet_pton(AF_INET6, a, &t1.sa6.sin6_addr); \
- tor_inet_pton(AF_INET6, b, &t2.sa6.sin6_addr); \
- t1.sa6.sin6_family = AF_INET6; \
- t2.sa6.sin6_family = AF_INET6; \
+ tor_inet_pton(AF_INET6, a, &t1.addr.in6_addr); \
+ tor_inet_pton(AF_INET6, b, &t2.addr.in6_addr); \
+ t1.family = AF_INET6; \
+ t2.family = AF_INET6; \
STMT_END
/*XXXX020 make this macro give useful output on failure, and follow the
* conventions of the other test macros. */
#define test_addr_parse(xx) STMT_BEGIN \
r=tor_addr_parse_mask_ports(xx, &t1, &mask, &port1, &port2); \
- t2.sa6.sin6_family = AF_INET6; \
- p1=tor_inet_ntop(AF_INET6, &t1.sa6.sin6_addr, bug, sizeof(bug)); \
+ t2.family = AF_INET6; \
+ p1=tor_inet_ntop(AF_INET6, &t1.addr.in6_addr, bug, sizeof(bug)); \
STMT_END
/*XXXX020 make this macro give useful output on failure, and follow the
@@ -1309,7 +1309,7 @@ test_util_ip6_helpers(void)
test_assert(TOR_ADDR_BUF_LEN >=
sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"));
- test_assert(sizeof(tor_addr_t) >= sizeof(struct sockaddr_in6));
+ test_assert(sizeof(tor_addr_t) >= sizeof(struct in6_addr));
/* get interface addresses */
r = get_interface_address6(0, AF_INET, &t1);