summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-07 09:38:33 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-07 09:38:33 -0700
commit1b2cac0cc59790620262f447588274440c7fbefa (patch)
tree1ae8b46490a4a4fec307af82bfcfd0cbf7e7597a
parent598a1d8dd7f621bb75a7f0537c5a63ee93e85a4c (diff)
downloadinfinitytier-1b2cac0cc59790620262f447588274440c7fbefa.tar.gz
infinitytier-1b2cac0cc59790620262f447588274440c7fbefa.zip
Trim some cruft that is not used and probably never would be.
-rw-r--r--include/ZeroTierOne.h27
-rw-r--r--node/IncomingPacket.cpp18
-rw-r--r--node/Node.cpp16
-rw-r--r--node/Node.hpp6
4 files changed, 4 insertions, 63 deletions
diff --git a/include/ZeroTierOne.h b/include/ZeroTierOne.h
index 341bb767..611e3699 100644
--- a/include/ZeroTierOne.h
+++ b/include/ZeroTierOne.h
@@ -256,38 +256,13 @@ 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
*
* These events are only generated if this is a TRACE-enabled build.
*
* Meta-data: C string, TRACE message
*/
- ZT_EVENT_TRACE = 8
+ ZT_EVENT_TRACE = 5
};
/**
diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp
index 305232ee..26d4bda8 100644
--- a/node/IncomingPacket.cpp
+++ b/node/IncomingPacket.cpp
@@ -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;
diff --git a/node/Node.cpp b/node/Node.cpp
index d5cc50b9..d5ca147c 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -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
}
}
diff --git a/node/Node.hpp b/node/Node.hpp
index 20c54471..0ae176c0 100644
--- a/node/Node.hpp
+++ b/node/Node.hpp
@@ -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;
};