From 0cc8276e896441a186a8080f127e35d60112d758 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 27 Jan 2016 16:16:27 +0100 Subject: [PATCH] Add AI_ADDRCONFIG to the getaddrinfo hints. A first step to untangle the ipv4 vs ipv6 mess. At the time of writing Linux, OpenBSD and FreeBSD all support the AI_ADDRCONFIG flag. --- src/core/network.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/network.c b/src/core/network.c index 28189661..d777bdcc 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -390,6 +390,7 @@ int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_ADDRCONFIG; /* save error to host_error for later use */ ret = getaddrinfo(addr, NULL, &hints, &ailist);