diff --git a/src/devices/wifi/mac-low.cc b/src/devices/wifi/mac-low.cc --- a/src/devices/wifi/mac-low.cc +++ b/src/devices/wifi/mac-low.cc @@ -350,6 +350,7 @@ NS_LOG_FUNCTION (this); m_lastNavDuration = Seconds (0); m_lastNavStart = Seconds (0); + m_promisc = false; } MacLow::~MacLow () @@ -551,7 +552,11 @@ { return m_bssid; } - +void +MacLow::SetPromisc (void) +{ + m_promisc = true; +} void MacLow::SetRxCallback (Callback,const WifiMacHeader *> callback) { @@ -877,6 +882,13 @@ // DROP } } + else if ((m_promisc) && (hdr.GetAddr1 () != m_self)) + { + if (hdr.IsData ()) + { + goto rxPacket; + } + } else { //NS_LOG_DEBUG_VERBOSE ("rx not-for-me from %d", GetSource (packet)); diff --git a/src/devices/wifi/mac-low.h b/src/devices/wifi/mac-low.h --- a/src/devices/wifi/mac-low.h +++ b/src/devices/wifi/mac-low.h @@ -386,6 +386,7 @@ Time GetSlotTime (void) const; Time GetPifs (void) const; Mac48Address GetBssid (void) const; + void SetPromisc (void); /** * \param callback the callback which receives every incoming packet. @@ -621,6 +622,8 @@ Time m_lastNavStart; Time m_lastNavDuration; + bool m_promisc; + // Listerner needed to monitor when a channel switching occurs. class PhyMacLowListener *m_phyMacLowListener; diff --git a/src/devices/wifi/regular-wifi-mac.cc b/src/devices/wifi/regular-wifi-mac.cc --- a/src/devices/wifi/regular-wifi-mac.cc +++ b/src/devices/wifi/regular-wifi-mac.cc @@ -389,6 +389,11 @@ { return m_low->GetBssid (); } +void +RegularWifiMac::SetPromisc (void) +{ + m_low->SetPromisc(); +} void RegularWifiMac::Enqueue (Ptr packet, diff --git a/src/devices/wifi/regular-wifi-mac.h b/src/devices/wifi/regular-wifi-mac.h --- a/src/devices/wifi/regular-wifi-mac.h +++ b/src/devices/wifi/regular-wifi-mac.h @@ -129,7 +129,7 @@ * \returns the bssid of the network this device belongs to. */ virtual Mac48Address GetBssid (void) const; - + virtual void SetPromisc (void); /** * \param packet the packet to send. * \param to the address to which the packet should be sent. diff --git a/src/devices/wifi/wifi-mac.h b/src/devices/wifi/wifi-mac.h --- a/src/devices/wifi/wifi-mac.h +++ b/src/devices/wifi/wifi-mac.h @@ -132,7 +132,7 @@ * \returns the bssid of the network this device belongs to. */ virtual Mac48Address GetBssid (void) const = 0; - + virtual void SetPromisc(void) = 0; /** * \param packet the packet to send. * \param to the address to which the packet should be sent. diff --git a/src/devices/wifi/wifi-net-device.cc b/src/devices/wifi/wifi-net-device.cc --- a/src/devices/wifi/wifi-net-device.cc +++ b/src/devices/wifi/wifi-net-device.cc @@ -357,6 +357,7 @@ WifiNetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb) { m_promiscRx = cb; + m_mac->SetPromisc(); } bool