diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-09-30 17:33:20 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-09-30 17:33:20 -0700 |
commit | ea6124dd2f48cafd8333d03705a8c8a9c201553d (patch) | |
tree | 2f32a8b4f08dcb4e452757b516a73446c9595733 | |
parent | b41437780b5740f7fcb813412b2bf4157ac8d807 (diff) | |
download | infinitytier-ea6124dd2f48cafd8333d03705a8c8a9c201553d.tar.gz infinitytier-ea6124dd2f48cafd8333d03705a8c8a9c201553d.zip |
IncomingPacket builds!
-rw-r--r-- | node/IncomingPacket.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 9701ec59..9e9407e2 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -971,9 +971,6 @@ bool IncomingPacket::_doMULTICAST_FRAME(const RuntimeEnvironment *RR,const Share unsigned int etherType = at<uint16_t>(comLen + ZT_PROTO_VERB_MULTICAST_FRAME_IDX_ETHERTYPE); unsigned int payloadLen = size() - (comLen + ZT_PROTO_VERB_MULTICAST_FRAME_IDX_FRAME); - if (!payloadLen) - return true; - if (!to.mac().isMulticast()) { TRACE("dropped MULTICAST_FRAME from %s@%s(%s) to %s: destination is unicast, must use FRAME or EXT_FRAME",from.toString().c_str(),peer->address().toString().c_str(),_remoteAddress.toString().c_str(),to.toString().c_str()); return true; @@ -984,7 +981,6 @@ bool IncomingPacket::_doMULTICAST_FRAME(const RuntimeEnvironment *RR,const Share return true; } - // If it's not from the sending peer, they must be allowed to bridge into this network if (from != MAC(peer->address(),network->id())) { if (network->permitsBridging(peer->address())) { network->learnBridgeRoute(from,peer->address()); @@ -994,20 +990,20 @@ bool IncomingPacket::_doMULTICAST_FRAME(const RuntimeEnvironment *RR,const Share } } - network->tapPut(from,to,etherType,field(comLen + ZT_PROTO_VERB_MULTICAST_FRAME_IDX_FRAME,payloadLen),payloadLen); - } + network->tapPut(from,to.mac(),etherType,field(comLen + ZT_PROTO_VERB_MULTICAST_FRAME_IDX_FRAME,payloadLen),payloadLen); - if (gatherLimit) { - Packet outp(source(),RR->identity.address(),Packet::VERB_OK); - outp.append((unsigned char)Packet::VERB_MULTICAST_FRAME); - outp.append(packetId()); - outp.append(nwid); - to.mac().appendTo(outp); - outp.append((uint32_t)to.adi()); - outp.append((unsigned char)0x01); // flag 0x01 = contains gather results - if (RR->mc->gather(RR,nwid,to,outp,gatherLimit)) { - outp.armor(peer->key(),true); - _fromSock->send(_remoteAddress,outp.data(),outp.size()); + if (gatherLimit) { + Packet outp(source(),RR->identity.address(),Packet::VERB_OK); + outp.append((unsigned char)Packet::VERB_MULTICAST_FRAME); + outp.append(packetId()); + outp.append(nwid); + to.mac().appendTo(outp); + outp.append((uint32_t)to.adi()); + outp.append((unsigned char)0x01); // flag 0x01 = contains gather results + if (RR->mc->gather(RR,nwid,to,outp,gatherLimit)) { + outp.armor(peer->key(),true); + _fromSock->send(_remoteAddress,outp.data(),outp.size()); + } } } } |