As recently reported on the Buildroot list:
http://lists.busybox.net/pipermail/buildroot/2016-March/155325.html
DNS lookups with Node.js currently fails on uClibc-ng. The reason for this
is the way AI_V4MAPPED is handled. According to POSIX, AI_V4MAPPED should
be ignored unless ai_family is AF_INET6:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.html
If the AI_V4MAPPED flag is specified along with an ai_family of AF_INET6,
then getaddrinfo() shall return IPv4-mapped IPv6 addresses on finding no
matching IPv6 addresses (ai_addrlen shall be 16). The AI_V4MAPPED flag
shall be ignored unless ai_family equals AF_INET6.
uClibc-ng was also handling AI_V4MAPPED for AF_UNSPEC, fix that.
Signed-off-by: Peter Korsgaard <peter(a)korsgaard.com>
---
libc/inet/getaddrinfo.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index 090d7e9..7ae32be 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -404,8 +404,7 @@ gaih_inet(const char *name, const struct gaih_service *service,
struct gaih_servtuple *st;
struct gaih_addrtuple *at;
int rc;
- int v4mapped = (req->ai_family == PF_UNSPEC || req->ai_family == PF_INET6)
- && (req->ai_flags & AI_V4MAPPED);
+ int v4mapped = req->ai_family == PF_INET6 && (req->ai_flags &
AI_V4MAPPED);
unsigned seen = 0;
if (req->ai_flags & AI_ADDRCONFIG) {
/* "seen" is only used when AI_ADDRCONFIG is specified.
--
2.7.0