Fixed conversion of prefix length to a netmask.

This commit is contained in:
Ruslan Ermilov 2011-03-01 11:47:16 +00:00
parent 2860553a86
commit 58202d8973

View File

@ -2875,7 +2875,7 @@ makemask(struct sockaddr_storage *ssp, int bitlen)
for (i = 0; i < len; i++) {
bits = (bitlen > CHAR_BIT) ? CHAR_BIT : bitlen;
*p++ = (1 << bits) - 1;
*p++ = (u_char)~0 << (CHAR_BIT - bits);
bitlen -= bits;
}
return 0;