mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 13:07:55 +00:00
Fix to IPv6 picking for small ranges.
This commit is contained in:
parent
6e08e1ae97
commit
b9329dc49a
@ -807,18 +807,16 @@ NetworkController::ResultCode SqliteNetworkController::doNetworkConfigRequest(co
|
|||||||
xx[0] = Utils::hton(x[0]);
|
xx[0] = Utils::hton(x[0]);
|
||||||
xx[1] = Utils::hton(x[1] + identity.address().toInt());
|
xx[1] = Utils::hton(x[1] + identity.address().toInt());
|
||||||
} else {
|
} else {
|
||||||
if (x[1] == 0xffffffffffffffffULL) {
|
// Otherwise pick random addresses -- this technically doesn't explore the whole range if the lower 64 bit range is >= 1 but that won't matter since that would be huge anyway
|
||||||
if (x[0] == 0xffffffffffffffffULL)
|
Utils::getSecureRandom((void *)xx,16);
|
||||||
break;
|
if ((e[0] > s[0]))
|
||||||
++x[0];
|
xx[0] %= (e[0] - s[0]);
|
||||||
x[1] = 0;
|
else xx[0] = 0;
|
||||||
} else {
|
if ((e[1] > s[1]))
|
||||||
++x[1];
|
xx[1] %= (e[1] - s[1]);
|
||||||
}
|
else xx[1] = 0;
|
||||||
if ((x[0] >= e[0])&&(x[1] >= e[1]))
|
xx[0] = Utils::hton(x[0] + xx[0]);
|
||||||
break;
|
xx[1] = Utils::hton(x[1] + xx[1]);
|
||||||
xx[0] = Utils::hton(x[0]);
|
|
||||||
xx[1] = Utils::hton(x[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InetAddress ip6((const void *)xx,16,0);
|
InetAddress ip6((const void *)xx,16,0);
|
||||||
|
Loading…
Reference in New Issue
Block a user