From 71ea9ccfdfa8aeceb29abeea3e5eacb9837043c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Tue, 1 Nov 2022 10:02:04 +0100 Subject: [PATCH] wifi: Fix WifiPpdu::CanBeReceived not returning false when the whole primary channel is not covered by the width of the incoming PPDU --- src/wifi/model/wifi-ppdu.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wifi/model/wifi-ppdu.cc b/src/wifi/model/wifi-ppdu.cc index 48beddd32..b9482d459 100644 --- a/src/wifi/model/wifi-ppdu.cc +++ b/src/wifi/model/wifi-ppdu.cc @@ -177,10 +177,12 @@ bool WifiPpdu::CanBeReceived(uint16_t p20MinFreq, uint16_t p20MaxFreq) const { NS_LOG_FUNCTION(this << p20MinFreq << p20MaxFreq); - const bool overlap = DoesOverlapChannel(p20MinFreq, p20MaxFreq); - if (!overlap) + uint16_t txChannelWidth = GetTxVector().GetChannelWidth(); + uint16_t minTxFreq = m_txCenterFreq - txChannelWidth / 2; + uint16_t maxTxFreq = m_txCenterFreq + txChannelWidth / 2; + if (p20MinFreq < minTxFreq || p20MaxFreq > maxTxFreq) { - NS_LOG_INFO("Received PPDU does not overlap with the primary20 channel"); + NS_LOG_INFO("Received PPDU does not cover the whole primary20 channel"); return false; } return true;