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
This commit is contained in:
Ruslan Ermilov 1999-06-04 11:20:59 +00:00
parent ea1dce7007
commit 43866c3e76

View File

@ -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);
}