diff options
author | ru <ru@FreeBSD.org> | 2001-07-11 16:11:15 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2001-07-11 16:11:15 +0000 |
commit | 637fad7f2d542998cff5269c64ed76c59591a131 (patch) | |
tree | b36d249a0114f56361c25a0c6a3d119ac8d52945 /sbin/route | |
parent | fd6cdfa2861498bd78b04c36486f2e241207e29d (diff) | |
download | FreeBSD-src-637fad7f2d542998cff5269c64ed76c59591a131.zip FreeBSD-src-637fad7f2d542998cff5269c64ed76c59591a131.tar.gz |
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''.
Diffstat (limited to 'sbin/route')
-rw-r--r-- | sbin/route/route.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index 38c35f7..6501854 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -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); |