diff options
| -rw-r--r-- | sbin/ip6fw/ip6fw.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/ip6fw/ip6fw.c b/sbin/ip6fw/ip6fw.c index 9f145403abf7..7069e5bf34ae 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); } |
