summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--node/Constants.hpp5
-rw-r--r--node/IncomingPacket.cpp2
-rw-r--r--node/Peer.cpp8
-rw-r--r--node/Peer.hpp1
-rw-r--r--node/Switch.cpp4
5 files changed, 15 insertions, 5 deletions
diff --git a/node/Constants.hpp b/node/Constants.hpp
index ed1153d5..cefd4863 100644
--- a/node/Constants.hpp
+++ b/node/Constants.hpp
@@ -318,6 +318,11 @@
#define ZT_MIN_BEACON_RESPONSE_INTERVAL 2500
/**
+ * Minimum delay between attempts to confirm new paths to peers (to avoid HELLO flooding)
+ */
+#define ZT_MIN_PATH_CONFIRMATION_INTERVAL 5000
+
+/**
* Sanity limit on maximum bridge routes
*
* If the number of bridge routes exceeds this, we cull routes from the
diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp
index aadef3c2..67e2ae2a 100644
--- a/node/IncomingPacket.cpp
+++ b/node/IncomingPacket.cpp
@@ -399,7 +399,7 @@ bool IncomingPacket::_doOK(const RuntimeEnvironment *RR,const SharedPtr<Peer> &p
const uint64_t nwid = at<uint64_t>(ZT_PROTO_VERB_MULTICAST_FRAME__OK__IDX_NETWORK_ID);
const MulticastGroup mg(MAC(field(ZT_PROTO_VERB_MULTICAST_FRAME__OK__IDX_MAC,6),6),at<uint32_t>(ZT_PROTO_VERB_MULTICAST_FRAME__OK__IDX_ADI));
- TRACE("%s(%s): OK(MULTICAST_FRAME) %.16llx/%s flags %.2x",peer->address().toString().c_str(),_remoteAddress.toString().c_str(),nwid,mg.toString().c_str(),flags);
+ //TRACE("%s(%s): OK(MULTICAST_FRAME) %.16llx/%s flags %.2x",peer->address().toString().c_str(),_remoteAddress.toString().c_str(),nwid,mg.toString().c_str(),flags);
unsigned int offset = 0;
diff --git a/node/Peer.cpp b/node/Peer.cpp
index 4d942957..526e3a28 100644
--- a/node/Peer.cpp
+++ b/node/Peer.cpp
@@ -45,6 +45,7 @@ Peer::Peer(const Identity &myIdentity,const Identity &peerIdentity)
_lastUnicastFrame(0),
_lastMulticastFrame(0),
_lastAnnouncedTo(0),
+ _lastPathConfirmationSent(0),
_vMajor(0),
_vMinor(0),
_vRevision(0),
@@ -111,8 +112,11 @@ void Peer::received(
* paths without confirming that a bidirectional link is in
* fact present, but any packet that decodes and authenticates
* correctly is considered valid. */
- TRACE("got non-confirmation %s from unknown path %s(%s), pinging...",Packet::verbString(verb),_id.address().toString().c_str(),remoteAddr.toString().c_str());
- attemptToContactAt(RR,remoteAddr,linkDesperation,now);
+ 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());
+ attemptToContactAt(RR,remoteAddr,linkDesperation,now);
+ }
}
}
}
diff --git a/node/Peer.hpp b/node/Peer.hpp
index 231e874d..d9ed5670 100644
--- a/node/Peer.hpp
+++ b/node/Peer.hpp
@@ -441,6 +441,7 @@ private:
uint64_t _lastUnicastFrame;
uint64_t _lastMulticastFrame;
uint64_t _lastAnnouncedTo;
+ uint64_t _lastPathConfirmationSent;
uint16_t _vProto;
uint16_t _vMajor;
uint16_t _vMinor;
diff --git a/node/Switch.cpp b/node/Switch.cpp
index 6bc044c0..8c27fdfa 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -153,7 +153,7 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
return;
}
- TRACE("%.16llx: MULTICAST %s -> %s %s %u",network->id(),from.toString().c_str(),mg.toString().c_str(),etherTypeName(etherType),len);
+ //TRACE("%.16llx: MULTICAST %s -> %s %s %u",network->id(),from.toString().c_str(),mg.toString().c_str(),etherTypeName(etherType),len);
RR->mc->send(
((!nconf->isPublic())&&(nconf->com())) ? &(nconf->com()) : (const CertificateOfMembership *)0,
@@ -204,7 +204,7 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
send(outp,true);
}
- TRACE("%.16llx: UNICAST: %s -> %s etherType==%s(%.4x) vlanId==%u len==%u fromBridged==%d",network->id(),from.toString().c_str(),to.toString().c_str(),etherTypeName(etherType),etherType,vlanId,len,(int)fromBridged);
+ //TRACE("%.16llx: UNICAST: %s -> %s etherType==%s(%.4x) vlanId==%u len==%u fromBridged==%d",network->id(),from.toString().c_str(),to.toString().c_str(),etherTypeName(etherType),etherType,vlanId,len,(int)fromBridged);
} else {
TRACE("%.16llx: UNICAST: %s -> %s etherType==%s dropped, destination not a member of private network",network->id(),from.toString().c_str(),to.toString().c_str(),etherTypeName(etherType));
}