Jelajahi Sumber

Check Network::isAllowed() always on multicast send.

Adam Ierymenko 10 tahun lalu
induk
melakukan
1632aec102
1 mengubah file dengan 8 tambahan dan 1 penghapusan
  1. 8 1
      node/OutboundMulticast.cpp

+ 8 - 1
node/OutboundMulticast.cpp

@@ -102,8 +102,14 @@ void OutboundMulticast::init(
 
 
 void OutboundMulticast::sendOnly(const RuntimeEnvironment *RR,const Address &toAddr)
 void OutboundMulticast::sendOnly(const RuntimeEnvironment *RR,const Address &toAddr)
 {
 {
+	SharedPtr<Network> network(RR->node->network(_nwid));
+
+	if (!network)
+		return;
+	if (!network->isAllowed(toAddr))
+		return;
+
 	if (_haveCom) {
 	if (_haveCom) {
-		SharedPtr<Network> network(RR->node->network(_nwid));
 		if (network->peerNeedsOurMembershipCertificate(toAddr,RR->node->now())) {
 		if (network->peerNeedsOurMembershipCertificate(toAddr,RR->node->now())) {
 			_packetWithCom.newInitializationVector();
 			_packetWithCom.newInitializationVector();
 			_packetWithCom.setDestination(toAddr);
 			_packetWithCom.setDestination(toAddr);
@@ -112,6 +118,7 @@ void OutboundMulticast::sendOnly(const RuntimeEnvironment *RR,const Address &toA
 			return;
 			return;
 		}
 		}
 	}
 	}
+
 	//TRACE(">>MC %.16llx -> %s (without COM)",(unsigned long long)this,toAddr.toString().c_str());
 	//TRACE(">>MC %.16llx -> %s (without COM)",(unsigned long long)this,toAddr.toString().c_str());
 	_packetNoCom.newInitializationVector();
 	_packetNoCom.newInitializationVector();
 	_packetNoCom.setDestination(toAddr);
 	_packetNoCom.setDestination(toAddr);