2015-04-01 00:53:34 +00:00
|
|
|
/*
|
2019-08-23 16:23:39 +00:00
|
|
|
* Copyright (c)2019 ZeroTier, Inc.
|
2015-04-01 00:53:34 +00:00
|
|
|
*
|
2019-08-23 16:23:39 +00:00
|
|
|
* Use of this software is governed by the Business Source License included
|
|
|
|
* in the LICENSE.TXT file in the project's root directory.
|
2015-04-01 00:53:34 +00:00
|
|
|
*
|
2019-08-23 16:23:39 +00:00
|
|
|
* Change Date: 2023-01-01
|
2015-04-01 00:53:34 +00:00
|
|
|
*
|
2019-08-23 16:23:39 +00:00
|
|
|
* On the date above, in accordance with the Business Source License, use
|
|
|
|
* of this software will be governed by version 2.0 of the Apache License.
|
2015-04-01 00:53:34 +00:00
|
|
|
*/
|
2019-08-23 16:23:39 +00:00
|
|
|
/****/
|
2015-04-01 00:53:34 +00:00
|
|
|
|
|
|
|
#ifndef ZT_NODE_HPP
|
|
|
|
#define ZT_NODE_HPP
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <map>
|
2017-02-13 22:27:08 +00:00
|
|
|
#include <vector>
|
2015-04-01 00:53:34 +00:00
|
|
|
|
|
|
|
#include "Constants.hpp"
|
|
|
|
|
|
|
|
#include "../include/ZeroTierOne.h"
|
|
|
|
|
2015-04-30 23:03:44 +00:00
|
|
|
#include "RuntimeEnvironment.hpp"
|
2015-04-01 00:53:34 +00:00
|
|
|
#include "InetAddress.hpp"
|
|
|
|
#include "Mutex.hpp"
|
|
|
|
#include "MAC.hpp"
|
2015-04-01 23:27:14 +00:00
|
|
|
#include "Network.hpp"
|
2015-07-06 22:05:04 +00:00
|
|
|
#include "Path.hpp"
|
2015-07-07 17:49:50 +00:00
|
|
|
#include "Salsa20.hpp"
|
2016-11-10 19:54:47 +00:00
|
|
|
#include "NetworkController.hpp"
|
2017-06-01 14:39:31 +00:00
|
|
|
#include "Hashtable.hpp"
|
2015-04-01 00:53:34 +00:00
|
|
|
|
2016-09-09 15:43:58 +00:00
|
|
|
// Bit mask for "expecting reply" hash
|
|
|
|
#define ZT_EXPECTING_REPLIES_BUCKET_MASK1 255
|
|
|
|
#define ZT_EXPECTING_REPLIES_BUCKET_MASK2 31
|
|
|
|
|
2015-04-01 00:53:34 +00:00
|
|
|
namespace ZeroTier {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of Node object as defined in CAPI
|
|
|
|
*
|
2015-09-24 23:21:36 +00:00
|
|
|
* The pointer returned by ZT_Node_new() is an instance of this class.
|
2015-04-01 00:53:34 +00:00
|
|
|
*/
|
2016-11-10 19:54:47 +00:00
|
|
|
class Node : public NetworkController::Sender
|
2015-04-01 00:53:34 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-10-02 22:52:57 +00:00
|
|
|
Node(void *uptr,void *tptr,const struct ZT_Node_Callbacks *callbacks,int64_t now);
|
2016-11-10 19:54:47 +00:00
|
|
|
virtual ~Node();
|
2015-04-01 00:53:34 +00:00
|
|
|
|
2017-01-20 20:00:18 +00:00
|
|
|
// Get rid of alignment warnings on 32-bit Windows and possibly improve performance
|
|
|
|
#ifdef __WINDOWS__
|
|
|
|
void * operator new(size_t i) { return _mm_malloc(i,16); }
|
|
|
|
void operator delete(void* p) { _mm_free(p); }
|
|
|
|
#endif
|
|
|
|
|
2015-04-01 00:53:34 +00:00
|
|
|
// Public API Functions ----------------------------------------------------
|
|
|
|
|
2015-09-24 23:21:36 +00:00
|
|
|
ZT_ResultCode processWirePacket(
|
2017-03-28 00:03:17 +00:00
|
|
|
void *tptr,
|
2017-10-02 22:52:57 +00:00
|
|
|
int64_t now,
|
2017-07-06 18:45:22 +00:00
|
|
|
int64_t localSocket,
|
2015-04-01 21:59:44 +00:00
|
|
|
const struct sockaddr_storage *remoteAddress,
|
|
|
|
const void *packetData,
|
|
|
|
unsigned int packetLength,
|
2017-10-02 22:52:57 +00:00
|
|
|
volatile int64_t *nextBackgroundTaskDeadline);
|
2015-09-24 23:21:36 +00:00
|
|
|
ZT_ResultCode processVirtualNetworkFrame(
|
2017-03-28 00:03:17 +00:00
|
|
|
void *tptr,
|
2017-10-02 22:52:57 +00:00
|
|
|
int64_t now,
|
2015-04-01 21:59:44 +00:00
|
|
|
uint64_t nwid,
|
|
|
|
uint64_t sourceMac,
|
|
|
|
uint64_t destMac,
|
|
|
|
unsigned int etherType,
|
|
|
|
unsigned int vlanId,
|
|
|
|
const void *frameData,
|
|
|
|
unsigned int frameLength,
|
2017-10-02 22:52:57 +00:00
|
|
|
volatile int64_t *nextBackgroundTaskDeadline);
|
|
|
|
ZT_ResultCode processBackgroundTasks(void *tptr,int64_t now,volatile int64_t *nextBackgroundTaskDeadline);
|
2019-09-19 16:47:12 +00:00
|
|
|
void processDNSResult(
|
|
|
|
void *tptr,
|
|
|
|
uintptr_t dnsRequestID,
|
|
|
|
const char *name,
|
|
|
|
enum ZT_DNSRecordType recordType,
|
|
|
|
const void *result,
|
|
|
|
unsigned int resultLength,
|
|
|
|
int resultIsString);
|
2017-03-28 00:03:17 +00:00
|
|
|
ZT_ResultCode join(uint64_t nwid,void *uptr,void *tptr);
|
|
|
|
ZT_ResultCode leave(uint64_t nwid,void **uptr,void *tptr);
|
|
|
|
ZT_ResultCode multicastSubscribe(void *tptr,uint64_t nwid,uint64_t multicastGroup,unsigned long multicastAdi);
|
2015-09-24 23:21:36 +00:00
|
|
|
ZT_ResultCode multicastUnsubscribe(uint64_t nwid,uint64_t multicastGroup,unsigned long multicastAdi);
|
2019-09-19 16:47:12 +00:00
|
|
|
ZT_RootList *listRoots(int64_t now);
|
|
|
|
enum ZT_ResultCode setStaticRoot(const char *identity,const struct sockaddr_storage *addresses,unsigned int addressCount);
|
|
|
|
enum ZT_ResultCode setDynamicRoot(const char *dnsName,const void *defaultLocator,unsigned int defaultLocatorSize);
|
|
|
|
enum ZT_ResultCode removeStaticRoot(const char *identity);
|
|
|
|
enum ZT_ResultCode removeDynamicRoot(const char *dnsName);
|
2015-04-14 01:43:33 +00:00
|
|
|
uint64_t address() const;
|
2015-09-24 23:21:36 +00:00
|
|
|
void status(ZT_NodeStatus *status) const;
|
|
|
|
ZT_PeerList *peers() const;
|
|
|
|
ZT_VirtualNetworkConfig *networkConfig(uint64_t nwid) const;
|
|
|
|
ZT_VirtualNetworkList *networks() const;
|
2015-04-01 00:53:34 +00:00
|
|
|
void freeQueryResult(void *qr);
|
2015-10-29 16:42:15 +00:00
|
|
|
int addLocalInterfaceAddress(const struct sockaddr_storage *addr);
|
2015-07-06 22:51:04 +00:00
|
|
|
void clearLocalInterfaceAddresses();
|
2017-03-28 00:03:17 +00:00
|
|
|
int sendUserMessage(void *tptr,uint64_t dest,uint64_t typeId,const void *data,unsigned int len);
|
2019-08-21 21:24:45 +00:00
|
|
|
void setController(void *networkControllerInstance);
|
2015-04-01 00:53:34 +00:00
|
|
|
|
|
|
|
// Internal functions ------------------------------------------------------
|
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE int64_t now() const { return _now; }
|
2015-04-01 00:53:34 +00:00
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE bool putPacket(void *tPtr,const int64_t localSocket,const InetAddress &addr,const void *data,unsigned int len,unsigned int ttl = 0)
|
2015-04-01 00:53:34 +00:00
|
|
|
{
|
2016-11-22 18:54:58 +00:00
|
|
|
return (_cb.wirePacketSendFunction(
|
2015-09-24 23:21:36 +00:00
|
|
|
reinterpret_cast<ZT_Node *>(this),
|
2015-04-24 20:35:17 +00:00
|
|
|
_uPtr,
|
2017-03-28 00:03:17 +00:00
|
|
|
tPtr,
|
2017-07-06 18:45:22 +00:00
|
|
|
localSocket,
|
2015-04-06 23:52:52 +00:00
|
|
|
reinterpret_cast<const struct sockaddr_storage *>(&addr),
|
|
|
|
data,
|
2015-11-09 23:44:13 +00:00
|
|
|
len,
|
|
|
|
ttl) == 0);
|
2015-04-01 00:53:34 +00:00
|
|
|
}
|
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE void putFrame(void *tPtr,uint64_t nwid,void **nuptr,const MAC &source,const MAC &dest,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len)
|
2015-04-01 00:53:34 +00:00
|
|
|
{
|
2016-11-22 18:54:58 +00:00
|
|
|
_cb.virtualNetworkFrameFunction(
|
2015-09-24 23:21:36 +00:00
|
|
|
reinterpret_cast<ZT_Node *>(this),
|
2015-04-24 20:35:17 +00:00
|
|
|
_uPtr,
|
2017-03-28 00:03:17 +00:00
|
|
|
tPtr,
|
2015-04-06 23:52:52 +00:00
|
|
|
nwid,
|
2016-01-12 19:04:35 +00:00
|
|
|
nuptr,
|
2015-04-06 23:52:52 +00:00
|
|
|
source.toInt(),
|
|
|
|
dest.toInt(),
|
|
|
|
etherType,
|
|
|
|
vlanId,
|
|
|
|
data,
|
|
|
|
len);
|
2015-04-01 00:53:34 +00:00
|
|
|
}
|
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE SharedPtr<Network> network(uint64_t nwid) const
|
2015-04-01 00:53:34 +00:00
|
|
|
{
|
|
|
|
Mutex::Lock _l(_networks_m);
|
2017-06-01 14:39:31 +00:00
|
|
|
const SharedPtr<Network> *n = _networks.get(nwid);
|
|
|
|
if (n)
|
|
|
|
return *n;
|
|
|
|
return SharedPtr<Network>();
|
2015-04-01 00:53:34 +00:00
|
|
|
}
|
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE bool belongsToNetwork(uint64_t nwid) const
|
2015-10-01 18:11:52 +00:00
|
|
|
{
|
|
|
|
Mutex::Lock _l(_networks_m);
|
2017-06-01 14:39:31 +00:00
|
|
|
return _networks.contains(nwid);
|
2015-10-01 18:11:52 +00:00
|
|
|
}
|
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE std::vector< SharedPtr<Network> > allNetworks() const
|
2015-04-07 01:27:24 +00:00
|
|
|
{
|
2015-06-26 18:38:31 +00:00
|
|
|
std::vector< SharedPtr<Network> > nw;
|
2015-04-07 01:27:24 +00:00
|
|
|
Mutex::Lock _l(_networks_m);
|
2017-06-01 14:39:31 +00:00
|
|
|
Hashtable< uint64_t,SharedPtr<Network> >::Iterator i(*const_cast< Hashtable< uint64_t,SharedPtr<Network> > * >(&_networks));
|
|
|
|
uint64_t *k = (uint64_t *)0;
|
|
|
|
SharedPtr<Network> *v = (SharedPtr<Network> *)0;
|
|
|
|
while (i.next(k,v))
|
|
|
|
nw.push_back(*v);
|
2015-04-07 01:27:24 +00:00
|
|
|
return nw;
|
|
|
|
}
|
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE std::vector<InetAddress> directPaths() const
|
2015-07-06 22:05:04 +00:00
|
|
|
{
|
2019-08-22 20:06:08 +00:00
|
|
|
Mutex::Lock _l(_localInterfaceAddresses_m);
|
|
|
|
return _localInterfaceAddresses;
|
2015-07-06 22:05:04 +00:00
|
|
|
}
|
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE void postEvent(void *tPtr,ZT_Event ev,const void *md = (const void *)0) { _cb.eventCallback(reinterpret_cast<ZT_Node *>(this),_uPtr,tPtr,ev,md); }
|
|
|
|
ZT_ALWAYS_INLINE int configureVirtualNetworkPort(void *tPtr,uint64_t nwid,void **nuptr,ZT_VirtualNetworkConfigOperation op,const ZT_VirtualNetworkConfig *nc) { return _cb.virtualNetworkConfigFunction(reinterpret_cast<ZT_Node *>(this),_uPtr,tPtr,nwid,nuptr,op,nc); }
|
|
|
|
ZT_ALWAYS_INLINE bool online() const { return _online; }
|
|
|
|
ZT_ALWAYS_INLINE int stateObjectGet(void *const tPtr,ZT_StateObjectType type,const uint64_t id[2],void *const data,const unsigned int maxlen) { return _cb.stateGetFunction(reinterpret_cast<ZT_Node *>(this),_uPtr,tPtr,type,id,data,maxlen); }
|
|
|
|
ZT_ALWAYS_INLINE void stateObjectPut(void *const tPtr,ZT_StateObjectType type,const uint64_t id[2],const void *const data,const unsigned int len) { _cb.statePutFunction(reinterpret_cast<ZT_Node *>(this),_uPtr,tPtr,type,id,data,(int)len); }
|
|
|
|
ZT_ALWAYS_INLINE void stateObjectDelete(void *const tPtr,ZT_StateObjectType type,const uint64_t id[2]) { _cb.statePutFunction(reinterpret_cast<ZT_Node *>(this),_uPtr,tPtr,type,id,(const void *)0,-1); }
|
2017-07-06 18:45:22 +00:00
|
|
|
bool shouldUsePathForZeroTierTraffic(void *tPtr,const Address &ztaddr,const int64_t localSocket,const InetAddress &remoteAddress);
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE bool externalPathLookup(void *tPtr,const Address &ztaddr,int family,InetAddress &addr) { return ( (_cb.pathLookupFunction) ? (_cb.pathLookupFunction(reinterpret_cast<ZT_Node *>(this),_uPtr,tPtr,ztaddr.toInt(),family,reinterpret_cast<struct sockaddr_storage *>(&addr)) != 0) : false ); }
|
2017-09-01 23:25:34 +00:00
|
|
|
ZT_ResultCode setPhysicalPathConfiguration(const struct sockaddr_storage *pathNetwork,const ZT_PhysicalPathConfiguration *pathConfig);
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE const Identity &identity() const { return _RR.identity; }
|
2017-06-05 19:15:28 +00:00
|
|
|
|
2016-09-09 15:43:58 +00:00
|
|
|
/**
|
|
|
|
* Register that we are expecting a reply to a packet ID
|
|
|
|
*
|
2017-03-01 17:41:37 +00:00
|
|
|
* This only uses the most significant bits of the packet ID, both to save space
|
|
|
|
* and to avoid using the higher bits that can be modified during armor() to
|
|
|
|
* mask against the packet send counter used for QoS detection.
|
|
|
|
*
|
2016-09-09 15:43:58 +00:00
|
|
|
* @param packetId Packet ID to expect reply to
|
|
|
|
*/
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE void expectReplyTo(const uint64_t packetId)
|
2016-09-09 15:43:58 +00:00
|
|
|
{
|
2017-03-03 21:49:21 +00:00
|
|
|
const unsigned long pid2 = (unsigned long)(packetId >> 32);
|
|
|
|
const unsigned long bucket = (unsigned long)(pid2 & ZT_EXPECTING_REPLIES_BUCKET_MASK1);
|
|
|
|
_expectingRepliesTo[bucket][_expectingRepliesToBucketPtr[bucket]++ & ZT_EXPECTING_REPLIES_BUCKET_MASK2] = (uint32_t)pid2;
|
2016-09-09 15:43:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-09-27 23:33:37 +00:00
|
|
|
* Check whether a given packet ID is something we are expecting a reply to
|
2016-09-09 15:43:58 +00:00
|
|
|
*
|
2017-03-01 17:41:37 +00:00
|
|
|
* This only uses the most significant bits of the packet ID, both to save space
|
|
|
|
* and to avoid using the higher bits that can be modified during armor() to
|
|
|
|
* mask against the packet send counter used for QoS detection.
|
|
|
|
*
|
2016-09-09 15:43:58 +00:00
|
|
|
* @param packetId Packet ID to check
|
|
|
|
* @return True if we're expecting a reply
|
|
|
|
*/
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE bool expectingReplyTo(const uint64_t packetId) const
|
2016-09-09 15:43:58 +00:00
|
|
|
{
|
2017-03-03 21:49:21 +00:00
|
|
|
const uint32_t pid2 = (uint32_t)(packetId >> 32);
|
|
|
|
const unsigned long bucket = (unsigned long)(pid2 & ZT_EXPECTING_REPLIES_BUCKET_MASK1);
|
2016-09-09 15:43:58 +00:00
|
|
|
for(unsigned long i=0;i<=ZT_EXPECTING_REPLIES_BUCKET_MASK2;++i) {
|
2017-03-03 21:49:21 +00:00
|
|
|
if (_expectingRepliesTo[bucket][i] == pid2)
|
2016-09-09 15:43:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-11-18 20:59:04 +00:00
|
|
|
/**
|
|
|
|
* Check whether we should do potentially expensive identity verification (rate limit)
|
|
|
|
*
|
|
|
|
* @param now Current time
|
|
|
|
* @param from Source address of packet
|
|
|
|
* @return True if within rate limits
|
|
|
|
*/
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE bool rateGateIdentityVerification(const int64_t now,const InetAddress &from)
|
2016-11-18 20:59:04 +00:00
|
|
|
{
|
|
|
|
unsigned long iph = from.rateGateHash();
|
|
|
|
if ((now - _lastIdentityVerification[iph]) >= ZT_IDENTITY_VALIDATION_SOURCE_RATE_LIMIT) {
|
|
|
|
_lastIdentityVerification[iph] = now;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-11-10 19:54:47 +00:00
|
|
|
virtual void ncSendConfig(uint64_t nwid,uint64_t requestPacketId,const Address &destination,const NetworkConfig &nc,bool sendLegacyFormatConfig);
|
2017-03-06 23:12:28 +00:00
|
|
|
virtual void ncSendRevocation(const Address &destination,const Revocation &rev);
|
2016-11-10 19:54:47 +00:00
|
|
|
virtual void ncSendError(uint64_t nwid,uint64_t requestPacketId,const Address &destination,NetworkController::ErrorCode errorCode);
|
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE void setMultipathMode(uint8_t mode) { _multipathMode = mode; }
|
|
|
|
ZT_ALWAYS_INLINE uint8_t getMultipathMode() { return _multipathMode; }
|
2018-05-01 23:32:15 +00:00
|
|
|
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE bool localControllerHasAuthorized(const int64_t now,const uint64_t nwid,const Address &addr) const
|
2019-03-14 21:29:15 +00:00
|
|
|
{
|
|
|
|
_localControllerAuthorizations_m.lock();
|
|
|
|
const int64_t *const at = _localControllerAuthorizations.get(_LocalControllerAuth(nwid,addr));
|
|
|
|
_localControllerAuthorizations_m.unlock();
|
|
|
|
if (at)
|
|
|
|
return ((now - *at) < (ZT_NETWORK_AUTOCONF_DELAY * 3));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-01 00:53:34 +00:00
|
|
|
private:
|
2015-04-30 23:03:44 +00:00
|
|
|
RuntimeEnvironment _RR;
|
2015-04-01 00:53:34 +00:00
|
|
|
RuntimeEnvironment *RR;
|
2015-04-24 20:35:17 +00:00
|
|
|
void *_uPtr; // _uptr (lower case) is reserved in Visual Studio :P
|
2016-11-22 18:54:58 +00:00
|
|
|
ZT_Node_Callbacks _cb;
|
2015-04-10 01:14:27 +00:00
|
|
|
|
2016-11-18 20:59:04 +00:00
|
|
|
// For tracking packet IDs to filter out OK/ERROR replies to packets we did not send
|
2016-09-09 15:43:58 +00:00
|
|
|
uint8_t _expectingRepliesToBucketPtr[ZT_EXPECTING_REPLIES_BUCKET_MASK1 + 1];
|
2017-03-01 17:41:37 +00:00
|
|
|
uint32_t _expectingRepliesTo[ZT_EXPECTING_REPLIES_BUCKET_MASK1 + 1][ZT_EXPECTING_REPLIES_BUCKET_MASK2 + 1];
|
2016-09-09 15:43:58 +00:00
|
|
|
|
2017-03-01 17:41:37 +00:00
|
|
|
// Time of last identity verification indexed by InetAddress.rateGateHash() -- used in IncomingPacket::_doHELLO() via rateGateIdentityVerification()
|
2017-10-02 22:52:57 +00:00
|
|
|
int64_t _lastIdentityVerification[16384];
|
2016-11-18 20:59:04 +00:00
|
|
|
|
2019-08-22 20:06:08 +00:00
|
|
|
/* Map that remembers if we have recently sent a network config to someone
|
|
|
|
* querying us as a controller. This is an optimization to allow network
|
|
|
|
* controllers to know whether to treat things like multicast queries the
|
|
|
|
* way authorized members would be treated without requiring an extra cert
|
|
|
|
* validation. */
|
2019-03-14 21:29:15 +00:00
|
|
|
struct _LocalControllerAuth
|
|
|
|
{
|
|
|
|
uint64_t nwid,address;
|
2019-09-12 17:37:26 +00:00
|
|
|
ZT_ALWAYS_INLINE _LocalControllerAuth(const uint64_t nwid_,const Address &address_) : nwid(nwid_),address(address_.toInt()) {}
|
|
|
|
ZT_ALWAYS_INLINE unsigned long hashCode() const { return (unsigned long)(nwid ^ address); }
|
|
|
|
ZT_ALWAYS_INLINE bool operator==(const _LocalControllerAuth &a) const { return ((a.nwid == nwid)&&(a.address == address)); }
|
|
|
|
ZT_ALWAYS_INLINE bool operator!=(const _LocalControllerAuth &a) const { return ((a.nwid != nwid)||(a.address != address)); }
|
2019-03-14 21:29:15 +00:00
|
|
|
};
|
|
|
|
Hashtable< _LocalControllerAuth,int64_t > _localControllerAuthorizations;
|
|
|
|
Mutex _localControllerAuthorizations_m;
|
|
|
|
|
2019-08-22 20:06:08 +00:00
|
|
|
// Curreently joined networks
|
2017-06-01 14:39:31 +00:00
|
|
|
Hashtable< uint64_t,SharedPtr<Network> > _networks;
|
2015-04-01 00:53:34 +00:00
|
|
|
Mutex _networks_m;
|
|
|
|
|
2019-08-22 20:06:08 +00:00
|
|
|
// Local interface addresses as reported by the code harnessing this Node
|
|
|
|
std::vector<InetAddress> _localInterfaceAddresses;
|
|
|
|
Mutex _localInterfaceAddresses_m;
|
2015-07-06 22:05:04 +00:00
|
|
|
|
2019-08-22 20:06:08 +00:00
|
|
|
// Lock to ensure processBackgroundTasks never gets run concurrently
|
2015-04-08 02:31:11 +00:00
|
|
|
Mutex _backgroundTasksLock;
|
|
|
|
|
2018-05-01 23:32:15 +00:00
|
|
|
uint8_t _multipathMode;
|
|
|
|
|
2018-01-11 22:29:57 +00:00
|
|
|
volatile int64_t _now;
|
2019-08-22 20:06:08 +00:00
|
|
|
int64_t _lastPing;
|
2017-10-02 22:52:57 +00:00
|
|
|
int64_t _lastHousekeepingRun;
|
2019-08-23 14:04:20 +00:00
|
|
|
int64_t _lastNetworkHousekeepingRun;
|
2019-09-19 16:47:12 +00:00
|
|
|
int64_t _lastDynamicRootUpdate;
|
2015-04-09 00:10:21 +00:00
|
|
|
bool _online;
|
2015-04-01 00:53:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ZeroTier
|
|
|
|
|
|
|
|
#endif
|