Filtering outgoing frames if peer link does not exist. Fixed order of going
authorKirill Andreev <andreev@iitp.ru>
Sat, 02 May 2009 16:51:00 +0400
changeset 5002 4ff127c1f6fa
parent 5001 8d4a10415c7f
child 5003 ad4576d966a6
Filtering outgoing frames if peer link does not exist. Fixed order of going through plugins
src/devices/mesh/dot11s/hwmp-mac-plugin.cc
src/devices/mesh/dot11s/peer-management-plugin.cc
src/devices/mesh/mesh-wifi-interface-mac.cc
--- a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc	Sat May 02 15:33:42 2009 +0400
+++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc	Sat May 02 16:51:00 2009 +0400
@@ -131,7 +131,8 @@
 HwmpMacPlugin::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) const
 {
   //TODO: add a mesh header and remove a TAG
-  NS_ASSERT(header.IsData ());
+  if(!header.IsData ())
+    return true;
   HwmpTag tag;
   bool tagExists = packet->RemovePacketTag(tag);
   NS_ASSERT (tagExists);
--- a/src/devices/mesh/dot11s/peer-management-plugin.cc	Sat May 02 15:33:42 2009 +0400
+++ b/src/devices/mesh/dot11s/peer-management-plugin.cc	Sat May 02 16:51:00 2009 +0400
@@ -133,8 +133,14 @@
 bool
 PeerManagerMacPlugin::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to) const
 {
-  if(header.IsData ())
-    return true;
+  if(header.IsAction ())
+  {
+    WifiMeshActionHeader actionHdr;
+    packet->PeekHeader (actionHdr);
+    WifiMeshActionHeader::ActionValue actionValue = actionHdr.GetAction ();
+    if(actionHdr.GetCategory () == WifiMeshActionHeader::MESH_PEER_LINK_MGT)
+      return true;
+  }
   if(header.GetAddr1 ().IsGroup ())
     return true;
   else
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc	Sat May 02 15:33:42 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc	Sat May 02 16:51:00 2009 +0400
@@ -388,7 +388,7 @@
   hdr.SetAddr1 (Mac48Address ());
 
   // Filter packet through all installed plugins
-  for (PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
+  for (PluginList::const_iterator i = m_plugins.end()-1; i != m_plugins.begin()-1; i--)
     {
       bool drop = ! ((*i)->UpdateOutcomingFrame(packet, hdr, from, to));
       if (drop) return; // plugin drops frame
@@ -416,7 +416,15 @@
 void
 MeshWifiInterfaceMac::SendManagementFrame (Ptr<Packet> packet, const WifiMacHeader& hdr)
 {
-  m_VO->Queue (packet, hdr);
+  //Filter management frames:
+  WifiMacHeader header = hdr;
+  for (PluginList::const_iterator i = m_plugins.end()-1; i != m_plugins.begin()-1; i--)
+    {
+      bool drop = ! ((*i)->UpdateOutcomingFrame(packet, header, Mac48Address (), Mac48Address ()));
+      if (drop) return; // plugin drops frame
+    }
+
+  m_VO->Queue (packet, header);
 }
 
 SupportedRates