]> git.ozlabs.org Git - ccan/commitdiff
net: fix tests for systems without IPv6 entries in /etc/hosts.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 4 Oct 2011 01:40:08 +0000 (12:10 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 4 Oct 2011 01:40:08 +0000 (12:10 +1030)
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.

ccan/net/test/run.c

index d7f6c95a040dc8814cd301e8ab2eaf37103cec29..bff1b6a79e47a47ec0ba994f4a83f980a2d91d27 100644 (file)
@@ -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,