summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-10-11 12:00:38 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-10-11 12:00:38 -0700
commit3f4c1668610801bfcb294bdffc909e00c4f9d6e9 (patch)
tree97042e3119918f6e818a4b549ad203785281b82f /node
parente53f63ca8700a526b15c2e7d05076d685734bcf6 (diff)
parent6a50291aa20cfca82f7648b3d6ff529cbe287c51 (diff)
downloadinfinitytier-3f4c1668610801bfcb294bdffc909e00c4f9d6e9.tar.gz
infinitytier-3f4c1668610801bfcb294bdffc909e00c4f9d6e9.zip
Merge branch 'dev' of http://10.6.6.2/zerotier/ZeroTierOne into dev
Diffstat (limited to 'node')
-rw-r--r--node/InetAddress.cpp10
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;
}