summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/Network.hpp2
-rw-r--r--node/Switch.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/node/Network.hpp b/node/Network.hpp
index 73178573..44c5d5b5 100644
--- a/node/Network.hpp
+++ b/node/Network.hpp
@@ -280,7 +280,7 @@ public:
/**
* Update multicast balance for an address and multicast group, return whether packet is allowed
*
- * @param a Address that wants to send/relay packet
+ * @param a Originating address of multicast packet
* @param mg Multicast group
* @param bytes Size of packet
* @return True if packet is within budget
diff --git a/node/Switch.cpp b/node/Switch.cpp
index 351034b2..2e021a5f 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -108,6 +108,11 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
mg = MulticastGroup::deriveMulticastGroupForAddressResolution(InetAddress(data.field(24,4),4,0));
}
+ if (!network->updateAndCheckMulticastBalance(_r->identity.address(),mg,data.size())) {
+ TRACE("%s: didn't multicast %d bytes, quota exceeded for multicast group %s",network->tapDeviceName().c_str(),(int)data.size(),mg.toString().c_str());
+ return;
+ }
+
const unsigned int mcid = ++_multicastIdCounter & 0xffffff;
const uint16_t bloomNonce = (uint16_t)(_r->prng->next32() & 0xffff); // doesn't need to be cryptographically strong
unsigned char bloom[ZT_PROTO_VERB_MULTICAST_FRAME_LEN_PROPAGATION_BLOOM];