summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2005-04-30 18:37:35 +0000
committerume <ume@FreeBSD.org>2005-04-30 18:37:35 +0000
commit7384d01d80905fb04664647a1b8741677745da0c (patch)
treed6c90c9fd6a0ec51270434caa3f4e017dccaedb2
parentc46ecbdc68d2fd1fe7f4fffcdf13f5c8454abbe6 (diff)
downloadFreeBSD-src-7384d01d80905fb04664647a1b8741677745da0c.zip
FreeBSD-src-7384d01d80905fb04664647a1b8741677745da0c.tar.gz
_gethostbynisname() didn't support RES_USE_INET6.
-rw-r--r--lib/libc/net/gethostbynis.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c
index 34fd289..ca1a9a5 100644
--- a/lib/libc/net/gethostbynis.c
+++ b/lib/libc/net/gethostbynis.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <stdarg.h>
#include <nsswitch.h>
+#include <resolv.h> /* XXX */
#ifdef YP
#include <rpc/rpc.h>
#include <rpcsvc/yp_prot.h>
@@ -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);
OpenPOWER on IntegriCloud