From d24895bdd16e0bfb19a96394dc31523071898d35 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 3 Sep 2008 10:37:22 -0700 Subject: [PATCH] forward a frame back to the wireless network only if the destination is associated, is a broadcast or multicast packet. --- src/devices/wifi/nqap-wifi-mac.cc | 38 +++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/devices/wifi/nqap-wifi-mac.cc b/src/devices/wifi/nqap-wifi-mac.cc index 69405a971..a79cd7200 100644 --- a/src/devices/wifi/nqap-wifi-mac.cc +++ b/src/devices/wifi/nqap-wifi-mac.cc @@ -418,28 +418,38 @@ NqapWifiMac::Receive (Ptr packet, WifiMacHeader const *hdr) { NS_LOG_FUNCTION (this << packet << hdr); - WifiRemoteStation *station = m_stationManager->Lookup (hdr->GetAddr2 ()); + Mac48Address from = hdr->GetAddr2 (); + WifiRemoteStation *fromStation = m_stationManager->Lookup (from); if (hdr->IsData ()) { + Mac48Address bssid = hdr->GetAddr1 (); if (!hdr->IsFromDs () && hdr->IsToDs () && - hdr->GetAddr1 () == GetAddress () && - station->IsAssociated ()) + bssid == GetAddress () && + fromStation->IsAssociated ()) { - if (hdr->GetAddr3 () == GetAddress ()) + Mac48Address to = hdr->GetAddr3 (); + WifiRemoteStation *toStation = m_stationManager->Lookup (to); + if (to == GetAddress ()) { - NS_LOG_DEBUG ("frame for me from="<GetAddr2 ()); - ForwardUp (packet, hdr->GetAddr2 (), hdr->GetAddr1 ()); + NS_LOG_DEBUG ("frame for me from="<IsAssociated ()) { - NS_LOG_DEBUG ("forwarding frame from="<GetAddr2 ()<<", to="<GetAddr3 ()); + NS_LOG_DEBUG ("forwarding frame from="<