mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Get a default rate that works for multicast.
This commit is contained in:
parent
d74b5f4bc6
commit
55e7ddba1e
3 changed files with 12 additions and 7 deletions
|
@ -261,7 +261,7 @@ error_no_ZT_ARCH_defined;
|
||||||
/**
|
/**
|
||||||
* Expiration time in ms for multicast deduplication history items
|
* Expiration time in ms for multicast deduplication history items
|
||||||
*/
|
*/
|
||||||
#define ZT_MULTICAST_DEDUP_HISTORY_EXPIRE 4000
|
#define ZT_MULTICAST_DEDUP_HISTORY_EXPIRE 2000
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Period between announcements of all multicast 'likes' in ms
|
* Period between announcements of all multicast 'likes' in ms
|
||||||
|
|
|
@ -117,8 +117,7 @@ bool Network::CertificateOfMembership::compare(const CertificateOfMembership &ot
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A low default global rate, fast enough for something like ARP
|
const Network::MulticastRates::Rate Network::MulticastRates::GLOBAL_DEFAULT_RATE(65535,65535,64);
|
||||||
const Network::MulticastRates::Rate Network::MulticastRates::GLOBAL_DEFAULT_RATE(128,128,64);
|
|
||||||
|
|
||||||
const char *Network::statusString(const Status s)
|
const char *Network::statusString(const Status s)
|
||||||
throw()
|
throw()
|
||||||
|
|
|
@ -105,10 +105,16 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
|
||||||
mg = MulticastGroup::deriveMulticastGroupForAddressResolution(InetAddress(data.field(24,4),4,0));
|
mg = MulticastGroup::deriveMulticastGroupForAddressResolution(InetAddress(data.field(24,4),4,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check our own multicasts against the global rate for this network
|
uint64_t crc = Multicaster::computeMulticastDedupCrc(network->id(),from,mg,etherType,data.data(),data.size());
|
||||||
// just to be polite.
|
uint64_t now = Utils::now();
|
||||||
|
|
||||||
|
if (_r->multicaster->checkDuplicate(crc,now)) {
|
||||||
|
LOG("%s/%.16llx: multicast group %s: dropped %u bytes, duplicate multicast in too short a time frame",network->tap().deviceName().c_str(),(unsigned long long)network->id(),mg.toString().c_str(),(unsigned int)data.size());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_r->multicaster->addToDedupHistory(crc,now);
|
||||||
if (!network->updateAndCheckMulticastBalance(_r->identity.address(),mg,data.size())) {
|
if (!network->updateAndCheckMulticastBalance(_r->identity.address(),mg,data.size())) {
|
||||||
LOG("didn't send local multicast %u byte multicast packet to network %.16llx: not within budget for multicast group %s",(unsigned int)data.size(),(unsigned long long)network->id(),mg.toString().c_str());
|
LOG("%s/%.16llx: multicast group %s: dropped %u bytes, out of budget",network->tap().deviceName().c_str(),(unsigned long long)network->id(),mg.toString().c_str(),(unsigned int)data.size());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +130,7 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c
|
||||||
bloom,
|
bloom,
|
||||||
ZT_MULTICAST_PROPAGATION_BREADTH,
|
ZT_MULTICAST_PROPAGATION_BREADTH,
|
||||||
propPeers,
|
propPeers,
|
||||||
Utils::now());
|
now);
|
||||||
|
|
||||||
if (!np)
|
if (!np)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue