diff options
Diffstat (limited to 'sbin/route')
-rw-r--r-- | sbin/route/route.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index b63ce63..809dc9f 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1033,6 +1033,13 @@ inet_makenetandmask(u_long net, struct sockaddr_in *sin, u_long bits) rtm_addrs |= RTA_NETMASK; /* + * MSB of net should be meaningful. 0/0 is exception. + */ + if (net > 0) + while ((net & 0xff000000) == 0) + net <<= 8; + + /* * If no /xx was specified we must calculate the * CIDR address. */ |