mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-21 13:57:49 +00:00
Apply multicast rate limits on a network to ourselves and do not send multicasts that would exceed limits, for GitHub issue #55
This commit is contained in:
parent
67a85221d5
commit
ab5a460177
@ -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
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user