Fix fallout from r243019, which broke parsing of shortened network

prefixes.

Reported and tested by:	delphij
This commit is contained in:
Gleb Smirnoff 2012-12-04 20:05:01 +00:00
parent 5c9fa630f6
commit 7c283ae860

View File

@ -1032,6 +1032,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.