diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-12-02 17:05:52 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-12-28 16:34:16 -0500 |
commit | aa529f6c32f2103a5571f98047ee3bd2d5074330 (patch) | |
tree | ea977e40cc4d347f5e11a7a203ff5b51f0d0b1e2 /src/test/test_addr.c | |
parent | e3a6493898fdca78b3b562f7cf870a26be526f70 (diff) | |
download | tor-aa529f6c32f2103a5571f98047ee3bd2d5074330.tar.gz tor-aa529f6c32f2103a5571f98047ee3bd2d5074330.zip |
Use getifaddrs, not connect+getsockname, to find our address
This resolves bug1827, and lets us avoid freaking people out.
Later, we can use it to get a complete list of our interfaces.
Diffstat (limited to 'src/test/test_addr.c')
-rw-r--r-- | src/test/test_addr.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/test/test_addr.c b/src/test/test_addr.c index 9d8e1fe8c5..cf9c8f91d5 100644 --- a/src/test/test_addr.c +++ b/src/test/test_addr.c @@ -613,12 +613,11 @@ test_addr_ip6_helpers(void) /* get interface addresses */ r = get_interface_address6(LOG_DEBUG, AF_INET, &t1); i = get_interface_address6(LOG_DEBUG, AF_INET6, &t2); -#if 0 - tor_inet_ntop(AF_INET, &t1.sa.sin_addr, buf, sizeof(buf)); - printf("\nv4 address: %s (family=%d)", buf, IN_FAMILY(&t1)); - tor_inet_ntop(AF_INET6, &t2.sa6.sin6_addr, buf, sizeof(buf)); - printf("\nv6 address: %s (family=%d)", buf, IN_FAMILY(&t2)); -#endif + + TT_BLATHER(("v4 address: %s (family=%d)", fmt_addr(&t1), + tor_addr_family(&t1))); + TT_BLATHER(("v6 address: %s (family=%d)", fmt_addr(&t2), + tor_addr_family(&t2))); done: ; |