Fix a possible infinite loop in "route flush" on 64-bit archs.

MFC after:	3 days
This commit is contained in:
hrs 2012-02-04 17:53:22 +00:00
parent d657a808e1
commit 0f7ce0eaaf

View File

@ -460,8 +460,8 @@ netname(struct sockaddr *sa)
* Guess at the subnet mask, assuming reasonable
* width subnet fields.
*/
while (in.s_addr &~ mask)
mask = (long)mask >> subnetshift;
while (in.s_addr & ~mask)
mask |= mask >> subnetshift;
net = in.s_addr & mask;
while ((mask & 1) == 0)
mask >>= 1, net >>= 1;