From 3300dc8b174e111cbbfdff0be2f8ff99488ecfcd Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Sat, 2 May 2009 16:51:00 +0400 Subject: [PATCH] Filtering outgoing frames if peer link does not exist. Fixed order of going through plugins --- src/devices/mesh/dot11s/hwmp-mac-plugin.cc | 3 ++- src/devices/mesh/dot11s/peer-management-plugin.cc | 10 ++++++++-- src/devices/mesh/mesh-wifi-interface-mac.cc | 12 ++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc index 7ab371bc4..6c30c3001 100644 --- a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc +++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc @@ -131,7 +131,8 @@ bool HwmpMacPlugin::UpdateOutcomingFrame (Ptr 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); diff --git a/src/devices/mesh/dot11s/peer-management-plugin.cc b/src/devices/mesh/dot11s/peer-management-plugin.cc index b7d55465c..f70e20949 100644 --- a/src/devices/mesh/dot11s/peer-management-plugin.cc +++ b/src/devices/mesh/dot11s/peer-management-plugin.cc @@ -133,8 +133,14 @@ PeerManagerMacPlugin::Receive (Ptr const_packet, const WifiMacHeader & h bool PeerManagerMacPlugin::UpdateOutcomingFrame (Ptr 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 diff --git a/src/devices/mesh/mesh-wifi-interface-mac.cc b/src/devices/mesh/mesh-wifi-interface-mac.cc index 872d93204..9224ff50b 100644 --- a/src/devices/mesh/mesh-wifi-interface-mac.cc +++ b/src/devices/mesh/mesh-wifi-interface-mac.cc @@ -388,7 +388,7 @@ MeshWifiInterfaceMac::ForwardDown (Ptr const_packet, Mac48Address 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 @@ MeshWifiInterfaceMac::ForwardDown (Ptr const_packet, Mac48Address void MeshWifiInterfaceMac::SendManagementFrame (Ptr 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