This commit is contained in:
Adam Ierymenko 2020-05-31 15:30:24 -07:00
parent 20ae12d385
commit 1003455160
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
3 changed files with 15 additions and 2 deletions

View file

@ -18,6 +18,16 @@
namespace ZeroTier {
Locator::Locator(const char *const str) noexcept
{
if (!fromString(str)) {
m_ts = 0;
m_signer.zero();
m_endpoints.clear();
m_signature.clear();
}
}
bool Locator::add(const Endpoint &ep)
{
if (m_endpoints.size() < ZT_LOCATOR_MAX_ENDPOINTS) {

View file

@ -44,6 +44,8 @@ public:
m_ts(0)
{}
explicit Locator(const char *const str) noexcept;
ZT_INLINE Locator(const Locator &loc) noexcept :
m_ts(loc.m_ts),
m_signer(loc.m_signer),

View file

@ -124,8 +124,9 @@ Node::Node(void *uPtr, void *tPtr, const struct ZT_Node_Callbacks *callbacks, in
for(unsigned int i=0;i<1023;++i)
RR->randomPrivilegedPortOrder[i] = (uint16_t)(i + 1);
for(unsigned int i=0;i<512;++i) {
const unsigned int a = (unsigned int)Utils::random() % 1023;
const unsigned int b = (unsigned int)Utils::random() % 1023;
uint64_t rn = Utils::random();
const unsigned int a = (unsigned int)rn % 1023;
const unsigned int b = (unsigned int)(rn >> 32U) % 1023;
if (a != b) {
const uint16_t tmp = RR->randomPrivilegedPortOrder[a];
RR->randomPrivilegedPortOrder[a] = RR->randomPrivilegedPortOrder[b];