mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-19 13:36:54 +02:00
1. Fix the issue where there is a chance of assigning the same IP when allocating IPs for simultaneous requests.
2. Optimizing the calculation method for converting IP ranges into the actual number of IP addresses.
This commit is contained in:
parent
03bd96d1d1
commit
22e98178c6
2 changed files with 4 additions and 1 deletions
|
@ -1235,6 +1235,7 @@ void EmbeddedNetworkController::_request(
|
|||
const Identity &identity,
|
||||
const Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> &metaData)
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_request_l);
|
||||
char nwids[24];
|
||||
DB::NetworkSummaryInfo ns;
|
||||
json network,member;
|
||||
|
@ -1736,7 +1737,7 @@ void EmbeddedNetworkController::_request(
|
|||
|
||||
if ((ipRangeEnd < ipRangeStart)||(ipRangeStart == 0))
|
||||
continue;
|
||||
uint32_t ipRangeLen = ipRangeEnd - ipRangeStart;
|
||||
uint32_t ipRangeLen = ipRangeEnd - ipRangeStart + 1;
|
||||
|
||||
// Start with the LSB of the member's address
|
||||
uint32_t ipTrialCounter = (uint32_t)(identity.address().toInt() & 0xffffffff);
|
||||
|
|
|
@ -160,6 +160,8 @@ private:
|
|||
|
||||
RedisConfig *_rc;
|
||||
std::string _ssoRedirectURL;
|
||||
|
||||
std::mutex _request_l;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
|
Loading…
Add table
Reference in a new issue