wifi: Check that frame belongs to BSS before setting the TXOP holder

This commit is contained in:
Stefano Avallone
2022-06-21 14:41:44 +02:00
parent b657a8df59
commit ed89f4f439
2 changed files with 9 additions and 4 deletions

View File

@@ -1542,9 +1542,9 @@ HeFrameExchangeManager::SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVect
{
NS_LOG_FUNCTION(this << psdu << txVector);
if (psdu->GetHeader(0).IsTrigger())
if (psdu->GetHeader(0).IsTrigger() && psdu->GetAddr2() == m_bssid)
{
m_txopHolder = psdu->GetAddr2();
m_txopHolder = m_bssid;
}
else if (!txVector.IsUlMu()) // the sender of a TB PPDU is not the TXOP holder
{

View File

@@ -683,11 +683,16 @@ QosFrameExchangeManager::SetTxopHolder(Ptr<const WifiPsdu> psdu, const WifiTxVec
const WifiMacHeader& hdr = psdu->GetHeader(0);
if (hdr.IsQosData() || hdr.IsMgt() || hdr.IsRts())
// A STA shall save the TXOP holder address for the BSS in which it is associated.
// The TXOP holder address is the MAC address from the Address 2 field of the frame
// that initiated a frame exchange sequence, except if this is a CTS frame, in which
// case the TXOP holder address is the Address 1 field. (Sec. 10.23.2.4 of 802.11-2020)
if ((hdr.IsQosData() || hdr.IsMgt() || hdr.IsRts()) &&
(hdr.GetAddr1() == m_bssid || hdr.GetAddr2() == m_bssid))
{
m_txopHolder = psdu->GetAddr2();
}
else if (hdr.IsCts())
else if (hdr.IsCts() && hdr.GetAddr1() == m_bssid)
{
m_txopHolder = psdu->GetAddr1();
}