diff -r 2285ad795bd8 src/devices/wifi/nqsta-wifi-mac.cc --- a/src/devices/wifi/nqsta-wifi-mac.cc Thu Oct 30 17:49:29 2008 +0000 +++ b/src/devices/wifi/nqsta-wifi-mac.cc Thu Oct 30 18:00:39 2008 +0000 @@ -494,6 +495,21 @@ } else if (hdr->IsData ()) { + if (!IsAssociated ()) + { + NS_LOG_LOGIC ("Received data frame while not associated: ignore"); + return; + } + if (!(hdr->IsFromDs () && !hdr->IsToDs ())) + { + NS_LOG_LOGIC ("Received data frame not from the DS: ignore"); + return; + } + if (hdr->GetAddr2 () != GetBssid ()) + { + NS_LOG_LOGIC ("Received data frame not from the the BSS we are associated with: ignore"); + return; + } NS_LOG_LOGIC ("ForwardUp"); ForwardUp (packet, hdr->GetAddr2 (), hdr->GetAddr1 ()); } @@ -511,12 +527,16 @@ if (GetSsid ().IsBroadcast () || beacon.GetSsid ().IsEqual (GetSsid ())) { + goodBeacon = true; + } + if (IsAssociated () && hdr->GetAddr3 () != GetBssid ()) + { + goodBeacon = false; + } + if (goodBeacon) + { Time delay = MicroSeconds (beacon.GetBeaconIntervalUs () * m_maxMissedBeacons); RestartBeaconWatchdog (delay); - goodBeacon = true; - } - if (goodBeacon) - { SetBssid (hdr->GetAddr3 ()); } if (goodBeacon && m_state == BEACON_MISSED)