diff options
author | ru <ru@FreeBSD.org> | 1999-06-04 11:20:59 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 1999-06-04 11:20:59 +0000 |
commit | d77ca2fb026ab6cd7a1e001774c902d817899f2d (patch) | |
tree | 3ef599ddc6e70afd7a0682eb487ae8e01b60f8ac /sbin/ipfw/ipfw.c | |
parent | 6f4d765d043aff53001e33f2afc84beefd65962d (diff) | |
download | FreeBSD-src-d77ca2fb026ab6cd7a1e001774c902d817899f2d.zip FreeBSD-src-d77ca2fb026ab6cd7a1e001774c902d817899f2d.tar.gz |
Fix the parsing of ip addresses on a command line.
PR: 5047
Reviewed by: des
Test case: ipfw add allow ip from 127.1 to any
Diffstat (limited to 'sbin/ipfw/ipfw.c')
-rw-r--r-- | sbin/ipfw/ipfw.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sbin/ipfw/ipfw.c b/sbin/ipfw/ipfw.c index 22332f1..81e8868 100644 --- a/sbin/ipfw/ipfw.c +++ b/sbin/ipfw/ipfw.c @@ -20,7 +20,7 @@ #ifndef lint static const char rcsid[] = - "$Id: ipfw.c,v 1.67 1999/05/29 08:12:38 kris Exp $"; + "$Id: ipfw.c,v 1.68 1999/06/02 05:59:48 ru Exp $"; #endif /* not lint */ @@ -612,13 +612,13 @@ lookup_host (host, ipaddr) char *host; struct in_addr *ipaddr; { - struct hostent *he = gethostbyname(host); - - if (!he) - return(-1); - - *ipaddr = *(struct in_addr *)he->h_addr_list[0]; + struct hostent *he; + if (!inet_aton(host, ipaddr)) { + if ((he = gethostbyname(host)) == NULL) + return(-1); + *ipaddr = *(struct in_addr *)he->h_addr_list[0]; + } return(0); } |