mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-22 06:17:48 +00:00
Trim some cruft that is not used and probably never would be.
This commit is contained in:
parent
598a1d8dd7
commit
1b2cac0cc5
@ -255,31 +255,6 @@ enum ZT_Event
|
||||
*/
|
||||
ZT_EVENT_FATAL_ERROR_IDENTITY_COLLISION = 4,
|
||||
|
||||
/**
|
||||
* A more recent version was observed on the network
|
||||
*
|
||||
* Right now this is only triggered if a hub or rootserver reports a
|
||||
* more recent version, and only once. It can be used to trigger a
|
||||
* software update check.
|
||||
*
|
||||
* Meta-data: unsigned int[3], more recent version number
|
||||
*/
|
||||
ZT_EVENT_SAW_MORE_RECENT_VERSION = 5,
|
||||
|
||||
/**
|
||||
* A packet failed authentication
|
||||
*
|
||||
* Meta-data: struct sockaddr_storage containing origin address of packet
|
||||
*/
|
||||
ZT_EVENT_AUTHENTICATION_FAILURE = 6,
|
||||
|
||||
/**
|
||||
* A received packet was not valid
|
||||
*
|
||||
* Meta-data: struct sockaddr_storage containing origin address of packet
|
||||
*/
|
||||
ZT_EVENT_INVALID_PACKET = 7,
|
||||
|
||||
/**
|
||||
* Trace (debugging) message
|
||||
*
|
||||
@ -287,7 +262,7 @@ enum ZT_Event
|
||||
*
|
||||
* Meta-data: C string, TRACE message
|
||||
*/
|
||||
ZT_EVENT_TRACE = 8
|
||||
ZT_EVENT_TRACE = 5
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -227,7 +227,6 @@ bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR)
|
||||
unsigned char key[ZT_PEER_SECRET_KEY_LENGTH];
|
||||
if (RR->identity.agree(id,key,ZT_PEER_SECRET_KEY_LENGTH)) {
|
||||
if (dearmor(key)) { // ensure packet is authentic, otherwise drop
|
||||
RR->node->postEvent(ZT_EVENT_AUTHENTICATION_FAILURE,(const void *)&_remoteAddress);
|
||||
TRACE("rejected HELLO from %s(%s): address already claimed",id.address().toString().c_str(),_remoteAddress.toString().c_str());
|
||||
Packet outp(id.address(),RR->identity.address(),Packet::VERB_ERROR);
|
||||
outp.append((unsigned char)Packet::VERB_HELLO);
|
||||
@ -236,11 +235,9 @@ bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR)
|
||||
outp.armor(key,true);
|
||||
RR->node->putPacket(_localAddress,_remoteAddress,outp.data(),outp.size());
|
||||
} else {
|
||||
RR->node->postEvent(ZT_EVENT_AUTHENTICATION_FAILURE,(const void *)&_remoteAddress);
|
||||
TRACE("rejected HELLO from %s(%s): packet failed authentication",id.address().toString().c_str(),_remoteAddress.toString().c_str());
|
||||
}
|
||||
} else {
|
||||
RR->node->postEvent(ZT_EVENT_AUTHENTICATION_FAILURE,(const void *)&_remoteAddress);
|
||||
TRACE("rejected HELLO from %s(%s): key agreement failed",id.address().toString().c_str(),_remoteAddress.toString().c_str());
|
||||
}
|
||||
|
||||
@ -249,7 +246,6 @@ bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR)
|
||||
// Identity is the same as the one we already have -- check packet integrity
|
||||
|
||||
if (!dearmor(peer->key())) {
|
||||
RR->node->postEvent(ZT_EVENT_AUTHENTICATION_FAILURE,(const void *)&_remoteAddress);
|
||||
TRACE("rejected HELLO from %s(%s): packet failed authentication",id.address().toString().c_str(),_remoteAddress.toString().c_str());
|
||||
return true;
|
||||
}
|
||||
@ -261,7 +257,6 @@ bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR)
|
||||
|
||||
// Check identity proof of work
|
||||
if (!id.locallyValidate()) {
|
||||
RR->node->postEvent(ZT_EVENT_AUTHENTICATION_FAILURE,(const void *)&_remoteAddress);
|
||||
TRACE("dropped HELLO from %s(%s): identity invalid",id.address().toString().c_str(),_remoteAddress.toString().c_str());
|
||||
return true;
|
||||
}
|
||||
@ -269,7 +264,6 @@ bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR)
|
||||
// Check packet integrity and authentication
|
||||
SharedPtr<Peer> newPeer(new Peer(RR->identity,id));
|
||||
if (!dearmor(newPeer->key())) {
|
||||
RR->node->postEvent(ZT_EVENT_AUTHENTICATION_FAILURE,(const void *)&_remoteAddress);
|
||||
TRACE("rejected HELLO from %s(%s): packet failed authentication",id.address().toString().c_str(),_remoteAddress.toString().c_str());
|
||||
return true;
|
||||
}
|
||||
@ -284,11 +278,7 @@ bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR)
|
||||
peer->received(RR,_localAddress,_remoteAddress,hops(),packetId(),Packet::VERB_HELLO,0,Packet::VERB_NOP);
|
||||
peer->setRemoteVersion(protoVersion,vMajor,vMinor,vRevision);
|
||||
|
||||
bool trusted = false;
|
||||
if (RR->topology->isRoot(id)) {
|
||||
RR->node->postNewerVersionIfNewer(vMajor,vMinor,vRevision);
|
||||
trusted = true;
|
||||
}
|
||||
bool trusted = RR->topology->isRoot(id);
|
||||
if (destAddr)
|
||||
RR->sa->iam(id.address(),_remoteAddress,destAddr,trusted,RR->node->now());
|
||||
|
||||
@ -369,11 +359,7 @@ bool IncomingPacket::_doOK(const RuntimeEnvironment *RR,const SharedPtr<Peer> &p
|
||||
peer->addDirectLatencyMeasurment(latency);
|
||||
peer->setRemoteVersion(vProto,vMajor,vMinor,vRevision);
|
||||
|
||||
bool trusted = false;
|
||||
if (RR->topology->isRoot(peer->identity())) {
|
||||
RR->node->postNewerVersionIfNewer(vMajor,vMinor,vRevision);
|
||||
trusted = true;
|
||||
}
|
||||
bool trusted = RR->topology->isRoot(peer->identity());
|
||||
if (destAddr)
|
||||
RR->sa->iam(peer->address(),_remoteAddress,destAddr,trusted,RR->node->now());
|
||||
} break;
|
||||
|
@ -82,9 +82,6 @@ Node::Node(
|
||||
_lastPingCheck(0),
|
||||
_lastHousekeepingRun(0)
|
||||
{
|
||||
_newestVersionSeen[0] = ZEROTIER_ONE_VERSION_MAJOR;
|
||||
_newestVersionSeen[1] = ZEROTIER_ONE_VERSION_MINOR;
|
||||
_newestVersionSeen[2] = ZEROTIER_ONE_VERSION_REVISION;
|
||||
_online = false;
|
||||
|
||||
// Use Salsa20 alone as a high-quality non-crypto PRNG
|
||||
@ -540,16 +537,6 @@ std::string Node::dataStoreGet(const char *name)
|
||||
return r;
|
||||
}
|
||||
|
||||
void Node::postNewerVersionIfNewer(unsigned int major,unsigned int minor,unsigned int rev)
|
||||
{
|
||||
if (Utils::compareVersion(major,minor,rev,_newestVersionSeen[0],_newestVersionSeen[1],_newestVersionSeen[2]) > 0) {
|
||||
_newestVersionSeen[0] = major;
|
||||
_newestVersionSeen[1] = minor;
|
||||
_newestVersionSeen[2] = rev;
|
||||
this->postEvent(ZT_EVENT_SAW_MORE_RECENT_VERSION,(const void *)_newestVersionSeen);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ZT_TRACE
|
||||
void Node::postTrace(const char *module,unsigned int line,const char *fmt,...)
|
||||
{
|
||||
@ -659,8 +646,7 @@ enum ZT_ResultCode ZT_Node_processWirePacket(
|
||||
} catch (std::bad_alloc &exc) {
|
||||
return ZT_RESULT_FATAL_ERROR_OUT_OF_MEMORY;
|
||||
} catch ( ... ) {
|
||||
reinterpret_cast<ZeroTier::Node *>(node)->postEvent(ZT_EVENT_INVALID_PACKET,(const void *)remoteAddress);
|
||||
return ZT_RESULT_OK;
|
||||
return ZT_RESULT_OK; // "OK" since invalid packets are simply dropped, but the system is still up
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,11 +226,6 @@ public:
|
||||
*/
|
||||
inline bool online() const throw() { return _online; }
|
||||
|
||||
/**
|
||||
* If this version is newer than the newest we've seen, post a new version seen event
|
||||
*/
|
||||
void postNewerVersionIfNewer(unsigned int major,unsigned int minor,unsigned int rev);
|
||||
|
||||
#ifdef ZT_TRACE
|
||||
void postTrace(const char *module,unsigned int line,const char *fmt,...);
|
||||
#endif
|
||||
@ -288,7 +283,6 @@ private:
|
||||
uint64_t _now;
|
||||
uint64_t _lastPingCheck;
|
||||
uint64_t _lastHousekeepingRun;
|
||||
unsigned int _newestVersionSeen[3]; // major, minor, revision
|
||||
bool _online;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user