Browse Source

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.

Adam Ierymenko 10 years ago
parent
commit
e071c05f1b
3 changed files with 7 additions and 9 deletions
  1. 3 6
      netconf-service/netconf-master.js
  2. 1 3
      netconf-service/redis-schema.md
  3. 3 0
      node/IncomingPacket.cpp

+ 3 - 6
netconf-service/netconf-master.js

@@ -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_NETWORK_ID = "nwid";
 var ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP = "ts";
 var ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP = "ts";
 var ZT_NETWORKCONFIG_DICT_KEY_ISSUED_TO = "id";
 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_MULTICAST_RATES = "mr";
 var ZT_NETWORKCONFIG_DICT_KEY_PRIVATE = "p";
 var ZT_NETWORKCONFIG_DICT_KEY_PRIVATE = "p";
 var ZT_NETWORKCONFIG_DICT_KEY_NAME = "n";
 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_NETWORK_ID] = nwid;
 					netconf.data[ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP] = Date.now().toString(16);
 					netconf.data[ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP] = Date.now().toString(16);
 					netconf.data[ZT_NETWORKCONFIG_DICT_KEY_ISSUED_TO] = peerId.address();
 					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']) {
 					if (network['multicastRates']) {
 						var ratesD = new Dictionary();
 						var ratesD = new Dictionary();
 						var ratesJ = JSON.parse(network['multicastRates']);
 						var ratesJ = JSON.parse(network['multicastRates']);

+ 1 - 3
netconf-service/redis-schema.md

@@ -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 v6AssignMode :: 'none' (or null/empty/etc.), 'zt', 'v6native', 'dhcp6'
 - M v6AssignPool :: network/bits from which to assign IPs
 - M v6AssignPool :: network/bits from which to assign IPs
 - M allowPassiveBridging :: if true, allow passive bridging
 - 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 multicastRates :: packed JSON containing multicast rates (see below)
 - M subscriptions :: comma-delimited list of subscriptions for this network
 - M subscriptions :: comma-delimited list of subscriptions for this network
 - M ui :: arbitrary field that can be used by the UI to store stuff
 - M ui :: arbitrary field that can be used by the UI to store stuff

+ 3 - 0
node/IncomingPacket.cpp

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