Fix route to check if inet_addr and inet_network return INADDR_NONE,
instead of -1 which is never returned by those routines.
This commit is contained in:
parent
48194b7e82
commit
2e32d69db1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=14132
@ -43,7 +43,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id: route.c,v 1.5 1996/02/06 20:36:10 wollman Exp $";
|
||||
"$Id: route.c,v 1.6 1996/02/13 17:30:34 wollman Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -890,7 +890,7 @@ getaddr(which, s, hpp)
|
||||
if (hpp == NULL)
|
||||
hpp = &hp;
|
||||
*hpp = NULL;
|
||||
if (((val = inet_addr(s)) != -1) &&
|
||||
if (((val = inet_addr(s)) != INADDR_NONE) &&
|
||||
(which != RTA_DST || forcenet == 0)) {
|
||||
su->sin.sin_addr.s_addr = val;
|
||||
if (inet_lnaof(su->sin.sin_addr) != INADDR_ANY)
|
||||
@ -900,7 +900,7 @@ getaddr(which, s, hpp)
|
||||
goto netdone;
|
||||
}
|
||||
}
|
||||
if ((val = inet_network(s)) != -1 ||
|
||||
if ((val = inet_network(s)) != INADDR_NONE ||
|
||||
((np = getnetbyname(s)) != NULL && (val = np->n_net) != 0)) {
|
||||
netdone:
|
||||
if (which == RTA_DST)
|
||||
|
Loading…
Reference in New Issue
Block a user