Bugfixes with tag
authorKirill Andreev <andreev@iitp.ru>
Thu, 02 Apr 2009 19:18:36 +0400
changeset 4941 aa44b6c49468
parent 4939 3fd32019af42
child 4942 f6dd61e25464
Bugfixes with tag
examples/mesh.cc
src/devices/mesh/dot11s/hwmp-mac-plugin.cc
src/devices/mesh/dot11s/hwmp-protocol.cc
src/devices/mesh/dot11s/hwmp-protocol.h
--- a/examples/mesh.cc	Thu Apr 02 17:57:18 2009 +0400
+++ b/examples/mesh.cc	Thu Apr 02 19:18:36 2009 +0400
@@ -39,11 +39,11 @@
 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;
   
--- a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc	Thu Apr 02 17:57:18 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc	Thu Apr 02 19:18:36 2009 +0400
@@ -73,8 +73,7 @@
     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 @@
   //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
--- a/src/devices/mesh/dot11s/hwmp-protocol.cc	Thu Apr 02 17:57:18 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol.cc	Thu Apr 02 19:18:36 2009 +0400
@@ -160,6 +160,7 @@
 )
 {
   HwmpTag tag;
+  tag.SetAddress(Mac48Address::GetBroadcast());
   if (sourceIface == GetMeshPoint ()->GetIfIndex())
     // packet from level 3
   {
@@ -168,7 +169,6 @@
     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 @@
   }
   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 @@
   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 @@
     if(result.retransmitter == Mac48Address::GetBroadcast ())
     {
       NS_LOG_UNCOND("I am"<<m_address<<" MP:"<<meshPointAddress<<"accessible through interface"<<interface<<", ra = "<<peerAddress);
-      m_rtable->AddReactivePath(meshPointAddress, peerAddress, interface, 1, Seconds (0), 0);
+      //m_rtable->AddReactivePath(meshPointAddress, peerAddress, interface, 1, Seconds (0), 0);
     }
   }
   else
@@ -706,7 +700,7 @@
     }
   for(HwmpPluginMap::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i ++)
   {
-    //i->second->RequestDestination(Mac48Address("00:00:00:00:00:04"));
+    i->second->RequestDestination(Mac48Address("00:00:00:00:00:20"));
     i->second->RequestDestination(dst);
   }
   m_preqTimeouts[dst] = Simulator::Schedule (
--- a/src/devices/mesh/dot11s/hwmp-protocol.h	Thu Apr 02 17:57:18 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-protocol.h	Thu Apr 02 19:18:36 2009 +0400
@@ -107,8 +107,6 @@
    */
   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
   //\{