From: Rusty Russell Date: Tue, 4 Oct 2011 01:40:08 +0000 (+1030) Subject: net: fix tests for systems without IPv6 entries in /etc/hosts. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=5b189c748dbc4b09e8180ce6fc6c2d0411968c48 net: fix tests for systems without IPv6 entries in /etc/hosts. We fake up a dual IPv4/IPv6 response to localhost for testing, but it assumed localhost6 or ip6-localhost entries. Fall back to "::1" which should always work. --- diff --git a/ccan/net/test/run.c b/ccan/net/test/run.c index d7f6c95a..bff1b6a7 100644 --- a/ccan/net/test/run.c +++ b/ccan/net/test/run.c @@ -69,6 +69,10 @@ static struct addrinfo* double_addr_lookup(char* buf) addr2 = net_client_lookup("localhost6", buf, AF_UNSPEC, SOCK_STREAM); + if (!addr2) + addr2 = net_client_lookup("::1", buf, + AF_UNSPEC, + SOCK_STREAM); } else if (addr->ai_family == AF_INET6) /* IPv6 only? This is a guess... */ addr2 = net_client_lookup("ip4-localhost", buf,