]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Don't set AI_ADDRCONFIG, even when it exists
authorAlexander Barton <alex@barton.de>
Tue, 29 Dec 2020 20:12:43 +0000 (21:12 +0100)
committerAlexander Barton <alex@barton.de>
Tue, 29 Dec 2020 20:12:43 +0000 (21:12 +0100)
Basically, the issue described in #281 is that the test suite uses the
IPv4 address 127.0.0.1 on an IPv6-only host. But this is the "safest"
thing to do in (almost) all other setups: relaying on DNS host names
makes things even more complex, as different systems map 127.0.0.1
differently (including the reverse lookup; that's why we switched to
127.0.0.1 back in 2014, see commit 3f807e10457).

But with AI_ADDRCONFIG set, on an IPv6-only host, we prevent 127.0.0.1
to get translated properly, even when the loopback interface has this
address configured! So don't set it any more.

The drawback is that the resolver possibly returns more addresses now,
even of an unsupported/not connected address family; but this shouldn't
do much harm in practice, as ngIRCd iterates over all returned addresses
while trying to establish an outgoing connection.

Closes #281.

src/ngircd/resolve.c

index 109d8b6c5491aaa69a3a0f8352b7fbdc3d872c8a..afbef5b375122711763fe91bb80f56c1a929c8db 100644 (file)
@@ -245,9 +245,6 @@ ForwardLookup(const char *hostname, array *IpAddr, UNUSED int af)
        struct addrinfo *a, *ai_results;
        static struct addrinfo hints;
 
-#ifdef AI_ADDRCONFIG   /* glibc has this, but not e.g. netbsd 4.0 */
-       hints.ai_flags = AI_ADDRCONFIG;
-#endif
        hints.ai_socktype = SOCK_STREAM;
        hints.ai_protocol = IPPROTO_TCP;
        hints.ai_family = af;