summaryrefslogtreecommitdiff
path: root/node/Network.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-09-18 18:28:14 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-09-18 18:28:14 -0700
commitd9abd4d9be7b160b531a995a20c91d430768fc72 (patch)
treeee632e3a61faf6d70c7aa0046a7f1eaeae8aca3f /node/Network.cpp
parentd37c3ad30f23f4c2dda23dfac6852dddde6af18d (diff)
downloadinfinitytier-d9abd4d9be7b160b531a995a20c91d430768fc72.tar.gz
infinitytier-d9abd4d9be7b160b531a995a20c91d430768fc72.zip
Work on defining new direct broadcast multicast algorithm.
Diffstat (limited to 'node/Network.cpp')
-rw-r--r--node/Network.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/node/Network.cpp b/node/Network.cpp
index 0eb3b359..8bcf185c 100644
--- a/node/Network.cpp
+++ b/node/Network.cpp
@@ -117,23 +117,23 @@ bool Network::updateMulticastGroups()
EthernetTap *t = _tap;
if (t) {
// Grab current groups from the local tap
- bool updated = t->updateMulticastGroups(_multicastGroups);
+ bool updated = t->updateMulticastGroups(_myMulticastGroups);
// Merge in learned groups from any hosts bridged in behind us
- for(std::map<MulticastGroup,uint64_t>::const_iterator mg(_bridgedMulticastGroups.begin());mg!=_bridgedMulticastGroups.end();++mg)
- _multicastGroups.insert(mg->first);
+ for(std::map<MulticastGroup,uint64_t>::const_iterator mg(_multicastGroupsBehindMe.begin());mg!=_multicastGroupsBehindMe.end();++mg)
+ _myMulticastGroups.insert(mg->first);
// Add or remove BROADCAST group based on broadcast enabled netconf flag
if ((_config)&&(_config->enableBroadcast())) {
- if (_multicastGroups.count(BROADCAST))
+ if (_myMulticastGroups.count(BROADCAST))
return updated;
else {
- _multicastGroups.insert(BROADCAST);
+ _myMulticastGroups.insert(BROADCAST);
return true;
}
} else {
- if (_multicastGroups.count(BROADCAST)) {
- _multicastGroups.erase(BROADCAST);
+ if (_myMulticastGroups.count(BROADCAST)) {
+ _myMulticastGroups.erase(BROADCAST);
return true;
} else return updated;
}
@@ -311,9 +311,9 @@ void Network::clean()
}
// Clean learned multicast groups if we haven't heard from them in a while
- for(std::map<MulticastGroup,uint64_t>::iterator mg(_bridgedMulticastGroups.begin());mg!=_bridgedMulticastGroups.end();) {
+ for(std::map<MulticastGroup,uint64_t>::iterator mg(_multicastGroupsBehindMe.begin());mg!=_multicastGroupsBehindMe.end();) {
if ((now - mg->second) > (ZT_MULTICAST_LIKE_EXPIRE * 2))
- _bridgedMulticastGroups.erase(mg++);
+ _multicastGroupsBehindMe.erase(mg++);
else ++mg;
}
}
@@ -419,23 +419,23 @@ void Network::threadMain()
void Network::learnBridgeRoute(const MAC &mac,const Address &addr)
{
Mutex::Lock _l(_lock);
- _bridgeRoutes[mac] = addr;
+ _remoteBridgeRoutes[mac] = addr;
- // If _bridgeRoutes exceeds sanity limit, trim worst offenders until below -- denial of service circuit breaker
- while (_bridgeRoutes.size() > ZT_MAX_BRIDGE_ROUTES) {
+ // If _remoteBridgeRoutes exceeds sanity limit, trim worst offenders until below -- denial of service circuit breaker
+ while (_remoteBridgeRoutes.size() > ZT_MAX_BRIDGE_ROUTES) {
std::map<Address,unsigned long> counts;
Address maxAddr;
unsigned long maxCount = 0;
- for(std::map<MAC,Address>::iterator br(_bridgeRoutes.begin());br!=_bridgeRoutes.end();++br) {
+ for(std::map<MAC,Address>::iterator br(_remoteBridgeRoutes.begin());br!=_remoteBridgeRoutes.end();++br) {
unsigned long c = ++counts[br->second];
if (c > maxCount) {
maxCount = c;
maxAddr = br->second;
}
}
- for(std::map<MAC,Address>::iterator br(_bridgeRoutes.begin());br!=_bridgeRoutes.end();) {
+ for(std::map<MAC,Address>::iterator br(_remoteBridgeRoutes.begin());br!=_remoteBridgeRoutes.end();) {
if (br->second == maxAddr)
- _bridgeRoutes.erase(br++);
+ _remoteBridgeRoutes.erase(br++);
else ++br;
}
}