mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 10:19:26 +00:00
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:
parent
d734b7d006
commit
1ce90245fb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=79588
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user