diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c index 34fd2895688e..ca1a9a56ad87 100644 --- a/lib/libc/net/gethostbynis.c +++ b/lib/libc/net/gethostbynis.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* XXX */ #ifdef YP #include #include @@ -98,6 +99,14 @@ _gethostbynis(const char *name, char *map, int af, struct hostent *he, switch (af) { case AF_INET: addrok = inet_aton(result, (struct in_addr *)hed->host_addr); + if (addrok != 1) + break; + if (_res.options & RES_USE_INET6) { + _map_v4v6_address((char *)hed->host_addr, + (char *)hed->host_addr); + af = AF_INET6; + size = NS_IN6ADDRSZ; + } break; case AF_INET6: addrok = inet_pton(af, result, hed->host_addr);