From 637fad7f2d542998cff5269c64ed76c59591a131 Mon Sep 17 00:00:00 2001 From: ru Date: Wed, 11 Jul 2001 16:11:15 +0000 Subject: 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''. --- sbin/route/route.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sbin/route') 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); -- cgit v1.1