diff --git a/examples/mesh.cc b/examples/mesh.cc index 6fa2ef50d..3775b1cc5 100644 --- a/examples/mesh.cc +++ b/examples/mesh.cc @@ -39,11 +39,11 @@ int main (int argc, char *argv[]) { // Creating square topology with nNodes x nNodes grid - int xSize = 2; - int ySize = 2; + int xSize = 4; + int ySize = 4; double step = 100.0; // Grid with one-hop edge double randomStart = 0.1; // One beacon interval - uint32_t nIfaces = 1; + uint32_t nIfaces = 2; bool chan = false; bool pcap = false; diff --git a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc index e3bae6766..29fa73ab7 100644 --- a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc +++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc @@ -73,8 +73,7 @@ HwmpMacPlugin::Receive (Ptr packet, const WifiMacHeader & header) if(meshHdr.GetMeshTtl () == 0) return false; tag.SetTtl (meshHdr.GetMeshTtl () - 1); - tag.SetAddress (header.GetAddr2 ()); - if(!m_protocol->RemoveTags(destination)) + if(m_protocol->GetAddress() != destination) packet->AddPacketTag(tag); if (destination == Mac48Address::GetBroadcast ()) if(m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (), header.GetAddr4 ()) ) @@ -135,13 +134,13 @@ HwmpMacPlugin::UpdateOutcomingFrame (Ptr packet, WifiMacHeader & header, //TODO: add a mesh header and remove a TAG NS_ASSERT(header.IsData ()); HwmpTag tag; - NS_ASSERT(packet->RemovePacketTag(tag)); + bool tagExists = packet->RemovePacketTag(tag); + NS_ASSERT(tagExists); WifiMeshHeader meshHdr; meshHdr.SetMeshSeqno(tag.GetSeqno()); meshHdr.SetMeshTtl(tag.GetTtl()); packet->AddHeader(meshHdr); header.SetAddr1(tag.GetAddress()); - NS_LOG_UNCOND("Broadcast sent"); return true; } void diff --git a/src/devices/mesh/dot11s/hwmp-protocol.cc b/src/devices/mesh/dot11s/hwmp-protocol.cc index 5d65fb309..3de8dac2b 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.cc +++ b/src/devices/mesh/dot11s/hwmp-protocol.cc @@ -160,6 +160,7 @@ HwmpProtocol::RequestRoute ( ) { HwmpTag tag; + tag.SetAddress(Mac48Address::GetBroadcast()); if (sourceIface == GetMeshPoint ()->GetIfIndex()) // packet from level 3 { @@ -168,7 +169,6 @@ HwmpProtocol::RequestRoute ( if(destination == Mac48Address::GetBroadcast ()) { tag.SetSeqno (m_dataSeqno++); - tag.SetAddress (Mac48Address::GetBroadcast()); tag.SetTtl (m_maxTtl+1); if (m_dataSeqno == 0xffffffff) m_dataSeqno = 0; @@ -184,7 +184,9 @@ HwmpProtocol::RequestRoute ( } if (destination == Mac48Address::GetBroadcast ()) { - NS_LOG_UNCOND("BROADCAS"); + packet->RemovePacketTag (tag); + tag.SetAddress (Mac48Address::GetBroadcast ()); + packet->AddPacketTag(tag); routeReply (true, packet, source, destination, protocolType, HwmpRtable::INTERFACE_ANY); } else @@ -250,14 +252,6 @@ HwmpProtocol::ForwardUnicast(uint32_t sourceIface, const Mac48Address source, c QueuePacket (pkt); return true; } -bool -HwmpProtocol::RemoveTags (Mac48Address dst) -{ - //Check that dst is my address - if(dst == m_address) - return true; - return false; -} void HwmpProtocol::ReceivePreq (IePreq preq, Mac48Address from, uint32_t interface) { @@ -503,7 +497,7 @@ HwmpProtocol::PeerLinkStatus(Mac48Address meshPointAddress, Mac48Address peerAdd if(result.retransmitter == Mac48Address::GetBroadcast ()) { NS_LOG_UNCOND("I am"<second->RequestDestination(Mac48Address("00:00:00:00:00:20")); i->second->RequestDestination(dst); } m_preqTimeouts[dst] = Simulator::Schedule ( diff --git a/src/devices/mesh/dot11s/hwmp-protocol.h b/src/devices/mesh/dot11s/hwmp-protocol.h index b06299640..f86262c7a 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.h +++ b/src/devices/mesh/dot11s/hwmp-protocol.h @@ -107,8 +107,6 @@ private: */ bool DropDataFrame(uint32_t, Mac48Address); //\} - ///\brief if the packet is ours - plugins should remove tag - bool RemoveTags (Mac48Address dst); private: ///\name Methods related to Queue/Dequeue procedures //\{