diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-06-26 18:13:48 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-06-26 18:13:48 -0700 |
commit | 458f6ae7c37c7877a842e7931edc67d9fed201cd (patch) | |
tree | 0d397bf16a3a67a9c8aff5ae64393915cb70656d /node | |
parent | 999e9635338dd706b02e6d5f696fb6da87a3e0d6 (diff) | |
download | infinitytier-458f6ae7c37c7877a842e7931edc67d9fed201cd.tar.gz infinitytier-458f6ae7c37c7877a842e7931edc67d9fed201cd.zip |
Only add active bridges to top of MC propagation list if they are alive. Otherwise a dead active bridge might kill multicast for us.
Diffstat (limited to 'node')
-rw-r--r-- | node/Network.hpp | 5 | ||||
-rw-r--r-- | node/Switch.cpp | 12 |
2 files changed, 11 insertions, 6 deletions
diff --git a/node/Network.hpp b/node/Network.hpp index 170e354f..03b011f3 100644 --- a/node/Network.hpp +++ b/node/Network.hpp @@ -401,11 +401,12 @@ public: * Learn a multicast group that is bridged to our tap device * * @param mg Multicast group + * @param now Current time */ - inline void learnBridgedMulticastGroup(const MulticastGroup &mg) + inline void learnBridgedMulticastGroup(const MulticastGroup &mg,uint64_t now) { Mutex::Lock _l(_lock); - _bridgedMulticastGroups[mg] = Utils::now(); + _bridgedMulticastGroups[mg] = now; } /** diff --git a/node/Switch.cpp b/node/Switch.cpp index 43f9b126..46fb0b49 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -121,6 +121,7 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c if (to.isMulticast()) { // Destination is a multicast address (including broadcast) + uint64_t now = Utils::now(); MulticastGroup mg(to,0); if (to.isBroadcast()) { @@ -140,7 +141,7 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c * multicast addresses on bridge interfaces and subscribing each slave. * But in that case this does no harm, as the sets are just merged. */ if (fromBridged) - network->learnBridgedMulticastGroup(mg); + network->learnBridgedMulticastGroup(mg,now); // Check multicast/broadcast bandwidth quotas and reject if quota exceeded if (!network->updateAndCheckMulticastBalance(_r->identity.address(),mg,data.size())) { @@ -166,9 +167,12 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c // All multicasts visit all active bridges first -- this is one of the two active/passive bridge differences for(std::set<Address>::const_iterator ab(nconf->activeBridges().begin());ab!=nconf->activeBridges().end();++ab) { if ((*ab != _r->identity.address())&&(ab->withinMulticastPropagationPrefix(prefix,nconf->multicastPrefixBits()))) { - ab->copyTo(fifoPtr,ZT_ADDRESS_LENGTH); - if ((fifoPtr += ZT_ADDRESS_LENGTH) == fifoEnd) - break; + SharedPtr<Peer> abPeer(_r->topology->getPeer(*ab)); + if ((abPeer)&&(abPeer->hasActiveDirectPath(now))) { + ab->copyTo(fifoPtr,ZT_ADDRESS_LENGTH); + if ((fifoPtr += ZT_ADDRESS_LENGTH) == fifoEnd) + break; + } } } |