summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sbin/ip6fw/ip6fw.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/ip6fw/ip6fw.c b/sbin/ip6fw/ip6fw.c
index 9f14540..7069e5b 100644
--- a/sbin/ip6fw/ip6fw.c
+++ b/sbin/ip6fw/ip6fw.c
@@ -548,13 +548,13 @@ lookup_host (host, addr, family)
char *host;
u_char *addr;
{
- struct hostent *he = gethostbyname2(host, family);
-
- if (!he)
- return(-1);
-
- memcpy(addr, he->h_addr_list[0], he->h_length);
+ struct hostent *he;
+ if (inet_pton(family, host, addr) != 1) {
+ if ((he = gethostbyname2(host, family)) == NULL)
+ return(-1);
+ memcpy(addr, he->h_addr_list[0], he->h_length);
+ }
return(0);
}
OpenPOWER on IntegriCloud