Add a sanity limit to legacy multicast repeater function in supernode-mode nodes, and change netconf-master to issue multicast limit (ml) instead of old p5 stuff.

This commit is contained in:
Adam Ierymenko 2014-10-10 14:59:07 -07:00
parent 03dc823ad7
commit e071c05f1b
3 changed files with 7 additions and 9 deletions

View File

@ -32,8 +32,7 @@ var ZT_NETWORKCONFIG_DICT_KEY_ALLOWED_ETHERNET_TYPES = "et";
var ZT_NETWORKCONFIG_DICT_KEY_NETWORK_ID = "nwid";
var ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP = "ts";
var ZT_NETWORKCONFIG_DICT_KEY_ISSUED_TO = "id";
var ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_PREFIX_BITS = "mpb";
var ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_DEPTH = "md";
var ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT = "ml";
var ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_RATES = "mr";
var ZT_NETWORKCONFIG_DICT_KEY_PRIVATE = "p";
var ZT_NETWORKCONFIG_DICT_KEY_NAME = "n";
@ -532,10 +531,8 @@ function doNetconfRequest(message)
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_NETWORK_ID] = nwid;
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP] = Date.now().toString(16);
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_ISSUED_TO] = peerId.address();
if (network['p5MulticastPrefixBits'])
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_PREFIX_BITS] = network['p5MulticastPrefixBits'];
if (network['p5MulticastDepth'])
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_DEPTH] = network['p5MulticastDepth'];
if (network['multicastLimit'])
netconf.data[ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT] = network['multicastLimit'];
if (network['multicastRates']) {
var ratesD = new Dictionary();
var ratesJ = JSON.parse(network['multicastRates']);

View File

@ -70,9 +70,7 @@ Each network has a network record indexed by its 64-bit network ID in lower-case
- M v6AssignMode :: 'none' (or null/empty/etc.), 'zt', 'v6native', 'dhcp6'
- M v6AssignPool :: network/bits from which to assign IPs
- M allowPassiveBridging :: if true, allow passive bridging
- M multicastAlgorithm :: currently only 'p5' is valid, or empty/missing for default
- M p5MulticastPrefixBits :: P5 multicast algorithm: prefix bits, 1-8 or 0 for default
- M p5MulticastDepth :: P5 multicast algorithm: depth (TTL) in or 0 for default
- M multicastLimit :: maximum number of recipients to receive a multicast on this network
- M multicastRates :: packed JSON containing multicast rates (see below)
- M subscriptions :: comma-delimited list of subscriptions for this network
- M ui :: arbitrary field that can be used by the UI to store stuff

View File

@ -610,11 +610,14 @@ bool IncomingPacket::_doP5_MULTICAST_FRAME(const RuntimeEnvironment *RR,const Sh
setSource(RR->identity.address());
compress();
unsigned int count = 0;
for(std::vector<Address>::iterator lp(legacyPeers.begin());lp!=legacyPeers.end();++lp) {
if ((*lp != origin)&&(*lp != source())) {
newInitializationVector();
setDestination(*lp);
RR->sw->send(*this,true);
if (++count >= 128) // harded-coded sanity limit for these legacy nodes
break;
}
}