Due to the documented bug in inet_aton(3), it wasn't possible

to use 0xffffffff (INADDR_NONE) as a netmask value.  The fix
is to use inet_addr(3) which doesn't suffer from this problem.

PR:		bin/28873

Also, while here, fixed the bug when netmask value was ignored
(RTF_HOST flag was set) if the "destination gateway netmask"
syntax is used, e.g. ``route add 1.2.3.4 127.1 255.255.255.255''.
This commit is contained in:
Ruslan Ermilov 2001-07-11 16:11:15 +00:00
parent d734b7d006
commit 1ce90245fb

View File

@ -736,6 +736,7 @@ newroute(argc, argv)
(void) getaddr(RTA_GATEWAY, *argv, &hp);
} else {
(void) getaddr(RTA_NETMASK, *argv, 0);
forcenet = 1;
}
}
}
@ -1030,8 +1031,8 @@ getaddr(which, s, hpp)
*q = '/';
}
if ((which != RTA_DST || forcenet == 0) &&
(val = inet_addr(s)) != INADDR_NONE) {
su->sin.sin_addr.s_addr = val;
inet_aton(s, &su->sin.sin_addr)) {
val = su->sin.sin_addr.s_addr;
if (which != RTA_DST ||
inet_lnaof(su->sin.sin_addr) != INADDR_ANY)
return (1);