mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r19385) -Fix [FS#3684]: [IPv6] Netmask calculations were wrong if cidr >= 32.
This commit is contained in:
parent
f7eb527a37
commit
6b35de215c
@ -161,7 +161,7 @@ bool NetworkAddress::IsInNetmask(char *netmask)
|
|||||||
|
|
||||||
while (cidr > 0) {
|
while (cidr > 0) {
|
||||||
uint32 msk = cidr >= 32 ? (uint32)-1 : htonl(-(1 << (32 - cidr)));
|
uint32 msk = cidr >= 32 ? (uint32)-1 : htonl(-(1 << (32 - cidr)));
|
||||||
if ((*mask & msk) != (*ip & msk)) return false;
|
if ((*mask++ & msk) != (*ip++ & msk)) return false;
|
||||||
|
|
||||||
cidr -= 32;
|
cidr -= 32;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user