diff options
author | Grant Limberg <grant.limberg@zerotier.com> | 2016-10-07 14:29:06 -0700 |
---|---|---|
committer | Grant Limberg <grant.limberg@zerotier.com> | 2016-10-07 14:29:06 -0700 |
commit | 6a50291aa20cfca82f7648b3d6ff529cbe287c51 (patch) | |
tree | 3a30c8bfdce604f0d1e588fef877922ad8ed44e2 /node | |
parent | e59ed3e68f6091a4bc5bb8b58cb080755feced3c (diff) | |
download | infinitytier-6a50291aa20cfca82f7648b3d6ff529cbe287c51.tar.gz infinitytier-6a50291aa20cfca82f7648b3d6ff529cbe287c51.zip |
Fix the case for InetAddress::containsAddress for IPv6 route of ::
Diffstat (limited to 'node')
-rw-r--r-- | node/InetAddress.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/node/InetAddress.cpp b/node/InetAddress.cpp index 12446909..7d22eeae 100644 --- a/node/InetAddress.cpp +++ b/node/InetAddress.cpp @@ -236,8 +236,14 @@ InetAddress InetAddress::netmask() const case AF_INET6: { uint64_t nm[2]; const unsigned int bits = netmaskBits(); - nm[0] = Utils::hton((uint64_t)((bits >= 64) ? 0xffffffffffffffffULL : (0xffffffffffffffffULL << (64 - bits)))); - nm[1] = Utils::hton((uint64_t)((bits <= 64) ? 0ULL : (0xffffffffffffffffULL << (128 - bits)))); + if(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); } break; } |