summaryrefslogtreecommitdiff
path: root/node/OutboundMulticast.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-08-04 13:01:14 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-08-04 13:01:14 -0700
commit37d139177dfdc6a0cf44f964a315184fca3fc3bd (patch)
tree7d01804cd6cb2e4c095cc1237cc4e9e4114fb9ee /node/OutboundMulticast.cpp
parent8a7753cfe3824ad378e779140fdd99f5c2873642 (diff)
downloadinfinitytier-37d139177dfdc6a0cf44f964a315184fca3fc3bd.tar.gz
infinitytier-37d139177dfdc6a0cf44f964a315184fca3fc3bd.zip
Integrate Filter into OutboundMulticast properly.
Diffstat (limited to 'node/OutboundMulticast.cpp')
-rw-r--r--node/OutboundMulticast.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/node/OutboundMulticast.cpp b/node/OutboundMulticast.cpp
index 344e0321..11268fe2 100644
--- a/node/OutboundMulticast.cpp
+++ b/node/OutboundMulticast.cpp
@@ -41,7 +41,13 @@ void OutboundMulticast::init(
{
_timestamp = timestamp;
_nwid = nwid;
+ if (src)
+ _macSrc = src;
+ else _macSrc.fromAddress(RR->identity.address(),nwid);
+ _macDest = dest.mac();
_limit = limit;
+ _frameLen = (len < ZT_MAX_MTU) ? len : ZT_MAX_MTU;
+ _etherType = etherType;
uint8_t flags = 0;
if (gatherLimit) flags |= 0x02;
@@ -68,23 +74,21 @@ void OutboundMulticast::init(
dest.mac().appendTo(_packet);
_packet.append((uint32_t)dest.adi());
_packet.append((uint16_t)etherType);
- _packet.append(payload,len);
+ _packet.append(payload,_frameLen);
_packet.compress();
+
+ memcpy(_frameData,payload,_frameLen);
}
void OutboundMulticast::sendOnly(const RuntimeEnvironment *RR,const Address &toAddr)
{
- // TODO: apply Filter
-
- SharedPtr<Peer> peer(RR->topology->getPeer(toAddr));
- if (peer) {
- // TODO: push creds if needed
+ const SharedPtr<Network> nw(RR->node->network(_nwid));
+ if ((nw)&&(nw->filterOutgoingPacket(RR->identity.address(),toAddr,_macSrc,_macDest,_frameData,_frameLen,_etherType,0))) {
+ //TRACE(">>MC %.16llx -> %s",(unsigned long long)this,toAddr.toString().c_str());
+ _packet.newInitializationVector();
+ _packet.setDestination(toAddr);
+ RR->sw->send(_packet,true,_nwid);
}
-
- //TRACE(">>MC %.16llx -> %s",(unsigned long long)this,toAddr.toString().c_str());
- _packet.newInitializationVector();
- _packet.setDestination(toAddr);
- RR->sw->send(_packet,true,_nwid);
}
} // namespace ZeroTier