diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-12-15 10:30:40 -0800 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-12-15 10:30:40 -0800 |
commit | 82aa3f59d6f60995719cc3d857b4fa3bb33df19d (patch) | |
tree | 8e11c5e65697fcb0309d5d36319f50aa3ec67fe6 /node/Peer.cpp | |
parent | 04d6b037334ae2da8523a1c83d9b02c89e9f1da1 (diff) | |
download | infinitytier-82aa3f59d6f60995719cc3d857b4fa3bb33df19d.tar.gz infinitytier-82aa3f59d6f60995719cc3d857b4fa3bb33df19d.zip |
Fix bug in ECHO handling (OK was invalid!), and use ECHO on newer peers for path confirmation. Also get rid of path confirmation circuit breaker since this causes issues with some peers and should be done more intelligently anyway.
Diffstat (limited to 'node/Peer.cpp')
-rw-r--r-- | node/Peer.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp index f0f43399..e93a27b8 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -53,7 +53,6 @@ Peer::Peer(const Identity &myIdentity,const Identity &peerIdentity) _lastUnicastFrame(0), _lastMulticastFrame(0), _lastAnnouncedTo(0), - _lastPathConfirmationSent(0), _lastDirectPathPushSent(0), _lastDirectPathPushReceive(0), _lastPathSort(0), @@ -132,7 +131,6 @@ void Peer::received( const uint64_t now = RR->node->now(); bool needMulticastGroupAnnounce = false; - bool pathIsConfirmed = false; { // begin _lock Mutex::Lock _l(_lock); @@ -149,6 +147,7 @@ void Peer::received( } if (hops == 0) { + bool pathIsConfirmed = false; unsigned int np = _numPaths; for(unsigned int p=0;p<np;++p) { if ((_paths[p].address() == remoteAddr)&&(_paths[p].localAddress() == localAddr)) { @@ -183,7 +182,6 @@ void Peer::received( slot->setClusterSuboptimal(suboptimalPath); #endif _numPaths = np; - pathIsConfirmed = true; _sortPaths(now); } @@ -194,13 +192,14 @@ void Peer::received( } else { - /* If this path is not known, send a HELLO. We don't learn - * paths without confirming that a bidirectional link is in - * fact present, but any packet that decodes and authenticates - * correctly is considered valid. */ - if ((now - _lastPathConfirmationSent) >= ZT_MIN_PATH_CONFIRMATION_INTERVAL) { - _lastPathConfirmationSent = now; - TRACE("got %s via unknown path %s(%s), confirming...",Packet::verbString(verb),_id.address().toString().c_str(),remoteAddr.toString().c_str()); + TRACE("got %s via unknown path %s(%s), confirming...",Packet::verbString(verb),_id.address().toString().c_str(),remoteAddr.toString().c_str()); + + if ((_vMajor >= 1)&&(_vMinor >= 1)&&(_vRevision >= 1)) { + // 1.1.1 and newer nodes support ECHO, which is smaller + Packet outp(_id.address(),RR->identity.address(),Packet::VERB_ECHO); + outp.armor(_key,true); + RR->node->putPacket(localAddr,remoteAddr,outp.data(),outp.size()); + } else { sendHELLO(RR,localAddr,remoteAddr,now); } |