mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Fix the case for InetAddress::containsAddress for IPv6 route of ::
This commit is contained in:
parent
e59ed3e68f
commit
6a50291aa2
1 changed files with 8 additions and 2 deletions
|
@ -236,8 +236,14 @@ InetAddress InetAddress::netmask() const
|
||||||
case AF_INET6: {
|
case AF_INET6: {
|
||||||
uint64_t nm[2];
|
uint64_t nm[2];
|
||||||
const unsigned int bits = netmaskBits();
|
const unsigned int bits = netmaskBits();
|
||||||
nm[0] = Utils::hton((uint64_t)((bits >= 64) ? 0xffffffffffffffffULL : (0xffffffffffffffffULL << (64 - bits))));
|
if(bits) {
|
||||||
nm[1] = Utils::hton((uint64_t)((bits <= 64) ? 0ULL : (0xffffffffffffffffULL << (128 - bits))));
|
nm[0] = Utils::hton((uint64_t)((bits >= 64) ? 0xffffffffffffffffULL : (0xffffffffffffffffULL << (64 - bits))));
|
||||||
|
nm[1] = Utils::hton((uint64_t)((bits <= 64) ? 0ULL : (0xffffffffffffffffULL << (128 - bits))));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nm[0] = 0;
|
||||||
|
nm[1] = 0;
|
||||||
|
}
|
||||||
memcpy(reinterpret_cast<struct sockaddr_in6 *>(&r)->sin6_addr.s6_addr,nm,16);
|
memcpy(reinterpret_cast<struct sockaddr_in6 *>(&r)->sin6_addr.s6_addr,nm,16);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue