From 79b01d701e9df582ce6b2ce5f7004146e7227d7c Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Wed, 8 Apr 2009 18:17:33 +0400 Subject: [PATCH] Broadcast is not forwarded twice into the same channel --- src/devices/mesh/dot11s/hwmp-mac-plugin.cc | 7 ++++++- src/devices/mesh/dot11s/hwmp-mac-plugin.h | 5 +++-- src/devices/mesh/dot11s/hwmp-protocol.cc | 9 +++++++++ src/devices/mesh/mesh-wifi-interface-mac.cc | 1 - 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc index 929ebb13b..45694b911 100644 --- a/src/devices/mesh/dot11s/hwmp-mac-plugin.cc +++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.cc @@ -309,9 +309,14 @@ HwmpMacPlugin::SendPerr(IePerr perr, std::vector receivers) SendOnePerr (); } uint32_t -HwmpMacPlugin::GetLinkMetric(Mac48Address peerAddress) +HwmpMacPlugin::GetLinkMetric(Mac48Address peerAddress) const { return m_parent->GetLinkMetric(peerAddress); } +uint16_t +HwmpMacPlugin::GetChannelId () const +{ + return m_parent->GetFrequencyChannel (); +} } //namespace dot11s }//namespace ns3 diff --git a/src/devices/mesh/dot11s/hwmp-mac-plugin.h b/src/devices/mesh/dot11s/hwmp-mac-plugin.h index f4ef4d8ba..cb8a8bede 100644 --- a/src/devices/mesh/dot11s/hwmp-mac-plugin.h +++ b/src/devices/mesh/dot11s/hwmp-mac-plugin.h @@ -69,9 +69,10 @@ private: /// Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue) void SendOnePreq (); void SendOnePerr (); - /// Returns metric to HWMP protocol, needed only by metrics to add + /// \return metric to HWMP protocol, needed only by metrics to add //peer as routing entry - uint32_t GetLinkMetric (Mac48Address peerAddress); + uint32_t GetLinkMetric (Mac48Address peerAddress) const; + uint16_t GetChannelId () const; private: Ptr m_parent; uint32_t m_ifIndex; diff --git a/src/devices/mesh/dot11s/hwmp-protocol.cc b/src/devices/mesh/dot11s/hwmp-protocol.cc index 8fbe172ec..37055e2a9 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.cc +++ b/src/devices/mesh/dot11s/hwmp-protocol.cc @@ -209,8 +209,17 @@ HwmpProtocol::RequestRoute ( } if (destination == Mac48Address::GetBroadcast ()) { + //channel IDs where we have already sent broadcast: + std::vector channels; for(HwmpPluginMap::const_iterator plugin = m_interfaces.begin (); plugin != m_interfaces.end (); plugin ++) { + bool should_send = true; + for(std::vector::const_iterator chan = channels.begin(); chan != channels.end(); chan ++) + if(*chan == plugin->second->GetChannelId ()) + should_send = false; + if(!should_send) + continue; + channels.push_back(plugin->second->GetChannelId ()); std::vector receivers = GetBroadcastReceivers (plugin->first); for (std::vector::const_iterator i = receivers.begin (); i != receivers.end(); i ++) { diff --git a/src/devices/mesh/mesh-wifi-interface-mac.cc b/src/devices/mesh/mesh-wifi-interface-mac.cc index 17480fbf4..f2c7754bb 100644 --- a/src/devices/mesh/mesh-wifi-interface-mac.cc +++ b/src/devices/mesh/mesh-wifi-interface-mac.cc @@ -27,7 +27,6 @@ #include "ns3/mac-rx-middle.h" #include "ns3/mac-low.h" #include "ns3/dca-txop.h" -//#include "ns3/mesh-wifi-mac-header.h" #include "ns3/random-variable.h" #include "ns3/simulator.h" #include "ns3/yans-wifi-phy.h"