mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-03-23 12:25:21 +00:00
Rip out network environment fingerprint. This will be replaced by constant monitoring of actual external address surface.
This commit is contained in:
parent
b1bf3f68c3
commit
b7148c107d
@ -274,11 +274,6 @@
|
||||
*/
|
||||
#define ZT_PING_CHECK_DELAY 10000
|
||||
|
||||
/**
|
||||
* Delay between checks of network configuration fingerprint
|
||||
*/
|
||||
#define ZT_NETWORK_FINGERPRINT_CHECK_DELAY 5000
|
||||
|
||||
/**
|
||||
* Delay between ordinary case pings of direct links
|
||||
*/
|
||||
|
@ -391,7 +391,6 @@ Node::ReasonForTermination Node::run()
|
||||
uint64_t lastNetworkAutoconfCheck = Utils::now() - 5000ULL; // check autoconf again after 5s for startup
|
||||
uint64_t lastPingCheck = 0;
|
||||
uint64_t lastClean = Utils::now(); // don't need to do this immediately
|
||||
uint64_t lastNetworkFingerprintCheck = 0;
|
||||
uint64_t lastMulticastCheck = 0;
|
||||
uint64_t lastSupernodePingCheck = 0;
|
||||
uint64_t lastBeacon = 0;
|
||||
@ -399,7 +398,6 @@ Node::ReasonForTermination Node::run()
|
||||
uint64_t lastShutdownIfUnreadableCheck = 0;
|
||||
long lastDelayDelta = 0;
|
||||
|
||||
uint64_t networkConfigurationFingerprint = 0;
|
||||
RR->timeOfLastResynchronize = Utils::now();
|
||||
|
||||
// We are up and running
|
||||
@ -432,17 +430,6 @@ Node::ReasonForTermination Node::run()
|
||||
Thread::sleep(ZT_SLEEP_WAKE_SETTLE_TIME);
|
||||
}
|
||||
|
||||
// If our network environment looks like it changed, resynchronize.
|
||||
if ((resynchronize)||((now - lastNetworkFingerprintCheck) >= ZT_NETWORK_FINGERPRINT_CHECK_DELAY)) {
|
||||
lastNetworkFingerprintCheck = now;
|
||||
uint64_t fp = RR->routingTable->networkEnvironmentFingerprint(RR->nc->networkTapDeviceNames());
|
||||
if (fp != networkConfigurationFingerprint) {
|
||||
LOG("netconf fingerprint change: %.16llx != %.16llx, resyncing with network",networkConfigurationFingerprint,fp);
|
||||
networkConfigurationFingerprint = fp;
|
||||
resynchronize = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Supernodes do not resynchronize unless explicitly ordered via SIGHUP.
|
||||
if ((resynchronize)&&(RR->topology->amSupernode()))
|
||||
resynchronize = false;
|
||||
|
@ -74,39 +74,4 @@ RoutingTable::~RoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t RoutingTable::networkEnvironmentFingerprint(const std::vector<std::string> &ignoreInterfaces) const
|
||||
{
|
||||
uint64_t fp = 0;
|
||||
std::vector<Entry> rtab(get());
|
||||
for(std::vector<Entry>::const_iterator re(rtab.begin());re!=rtab.end();++re) {
|
||||
bool skip = false;
|
||||
for(std::vector<std::string>::const_iterator ii(ignoreInterfaces.begin());ii!=ignoreInterfaces.end();++ii) {
|
||||
if (*ii == re->device) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (skip)
|
||||
continue;
|
||||
++fp;
|
||||
if (re->destination.isV4()) {
|
||||
fp = Utils::sdbmHash(re->destination.rawIpData(),4,fp);
|
||||
fp = Utils::sdbmHash((uint16_t)re->destination.netmaskBits(),fp);
|
||||
} else if (re->destination.isV6()) {
|
||||
fp = Utils::sdbmHash(re->destination.rawIpData(),16,fp);
|
||||
fp = Utils::sdbmHash((uint16_t)re->destination.netmaskBits(),fp);
|
||||
}
|
||||
if (re->gateway.isV4()) {
|
||||
fp = Utils::sdbmHash(re->gateway.rawIpData(),4,fp);
|
||||
fp = Utils::sdbmHash((uint16_t)re->gateway.netmaskBits(),fp);
|
||||
} else if (re->gateway.isV6()) {
|
||||
fp = Utils::sdbmHash(re->gateway.rawIpData(),16,fp);
|
||||
fp = Utils::sdbmHash((uint16_t)re->gateway.netmaskBits(),fp);
|
||||
}
|
||||
fp = Utils::sdbmHash(re->device,fp);
|
||||
fp = Utils::sdbmHash((uint32_t)re->metric,fp);
|
||||
}
|
||||
return fp;
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
@ -115,16 +115,6 @@ public:
|
||||
* @return Entry or null entry on failure (or delete)
|
||||
*/
|
||||
virtual RoutingTable::Entry set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric) = 0;
|
||||
|
||||
/**
|
||||
* Compute a 64-bit value that hashes the current state of the network environment
|
||||
*
|
||||
* This shouldn't be overridden -- uses get() to get underlying routing table.
|
||||
*
|
||||
* @param ignoreInterfaces Names of interfaces to exclude from fingerprint (e.g. my own)
|
||||
* @return Integer CRC-type fingerprint of current network environment
|
||||
*/
|
||||
uint64_t networkEnvironmentFingerprint(const std::vector<std::string> &ignoreInterfaces) const;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
Loading…
x
Reference in New Issue
Block a user