From fda9fc490d9290dae80224376edb6e3c817294cf Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Tue, 28 Mar 2023 12:23:43 +0200 Subject: [PATCH] wifi: There is no ERP Information in AssocResp frames --- src/wifi/model/ap-wifi-mac.cc | 4 ---- src/wifi/model/mgt-headers.cc | 31 ------------------------------- src/wifi/model/mgt-headers.h | 17 ----------------- src/wifi/model/sta-wifi-mac.cc | 19 +++++++++++++++---- 4 files changed, 15 insertions(+), 56 deletions(-) diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index bae3efac9..e3d8c4ea2 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -1031,10 +1031,6 @@ ApWifiMac::GetAssocResp(Mac48Address to, uint8_t linkId) assoc.SetSupportedRates(GetSupportedRates(linkId)); assoc.SetStatusCode(code); assoc.SetCapabilities(GetCapabilities(linkId)); - if (GetErpSupported(linkId)) - { - assoc.SetErpInformation(GetErpInformation(linkId)); - } if (GetQosSupported()) { assoc.SetEdcaParameterSet(GetEdcaParameterSet(linkId)); diff --git a/src/wifi/model/mgt-headers.cc b/src/wifi/model/mgt-headers.cc index 82646850e..5c5f6c30d 100644 --- a/src/wifi/model/mgt-headers.cc +++ b/src/wifi/model/mgt-headers.cc @@ -1841,24 +1841,6 @@ MgtAssocResponseHeader::GetAssociationId() const return m_aid; } -void -MgtAssocResponseHeader::SetErpInformation(const ErpInformation& erpInformation) -{ - m_erpInformation = erpInformation; -} - -void -MgtAssocResponseHeader::SetErpInformation(ErpInformation&& erpInformation) -{ - m_erpInformation = std::move(erpInformation); -} - -const std::optional& -MgtAssocResponseHeader::GetErpInformation() const -{ - return m_erpInformation; -} - void MgtAssocResponseHeader::SetEdcaParameterSet(const EdcaParameterSet& edcaparameters) { @@ -1919,10 +1901,6 @@ MgtAssocResponseHeader::GetSerializedSize() const size += m_code.GetSerializedSize(); size += 2; // aid size += m_rates.GetSerializedSize(); - if (m_erpInformation.has_value()) - { - size += m_erpInformation->GetSerializedSize(); - } if (m_rates.GetNRates() > 8) { size += m_rates.extended->GetSerializedSize(); @@ -1984,10 +1962,6 @@ MgtAssocResponseHeader::Print(std::ostream& os) const os << "status code=" << m_code << ", " << "aid=" << m_aid << ", " << "rates=" << m_rates << ", "; - if (m_erpInformation.has_value()) - { - os << "ERP information=" << *m_erpInformation << ", "; - } if (m_extendedCapability.has_value()) { os << "Extended Capabilities=" << *m_extendedCapability << " , "; @@ -2034,10 +2008,6 @@ MgtAssocResponseHeader::Serialize(Buffer::Iterator start) const i = m_code.Serialize(i); i.WriteHtolsbU16(m_aid); i = m_rates.Serialize(i); - if (m_erpInformation.has_value()) - { - i = m_erpInformation->Serialize(i); - } if (m_rates.GetNRates() > 8) { i = m_rates.extended->Serialize(i); @@ -2101,7 +2071,6 @@ MgtAssocResponseHeader::Deserialize(Buffer::Iterator start) i = m_code.Deserialize(i); m_aid = i.ReadLsbtohU16(); i = m_rates.Deserialize(i); - i = WifiInformationElement::DeserializeIfPresent(m_erpInformation, i); i = WifiInformationElement::DeserializeIfPresent(m_rates.extended, i, &m_rates); i = WifiInformationElement::DeserializeIfPresent(m_edcaParameterSet, i); i = WifiInformationElement::DeserializeIfPresent(m_extendedCapability, i); diff --git a/src/wifi/model/mgt-headers.h b/src/wifi/model/mgt-headers.h index 7de26aa10..e641edbdb 100644 --- a/src/wifi/model/mgt-headers.h +++ b/src/wifi/model/mgt-headers.h @@ -533,12 +533,6 @@ class MgtAssocResponseHeader : public Header * \return the association ID */ uint16_t GetAssociationId() const; - /** - * Return the ERP information, if present. - * - * \return the ERP information, if present - */ - const std::optional& GetErpInformation() const; /** * Return the EDCA Parameter Set, if present. * @@ -635,16 +629,6 @@ class MgtAssocResponseHeader : public Header */ void SetAssociationId(uint16_t aid); - /** - * Set the ERP information. - * - * \param erpInformation the ERP information - */ - void SetErpInformation(const ErpInformation& erpInformation); - - /** \copydoc SetErpInformation */ - void SetErpInformation(ErpInformation&& erpInformation); - /** * Set the EDCA Parameter Set. * @@ -736,7 +720,6 @@ class MgtAssocResponseHeader : public Header std::optional m_htOperation; //!< HT operation std::optional m_vhtCapability; //!< VHT capabilities std::optional m_vhtOperation; //!< VHT operation - std::optional m_erpInformation; //!< ERP information std::optional m_edcaParameterSet; //!< EDCA Parameter Set std::optional m_heCapability; //!< HE capabilities std::optional m_heOperation; //!< HE operation diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index c7ccc1181..0558305c9 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -1193,6 +1193,18 @@ StaWifiMac::UpdateApInfo(const MgtFrameType& frame, { NS_LOG_FUNCTION(this << frame.index() << apAddr << bssid << +linkId); + // ERP Information is not present in Association Response frames + const std::optional* erpInformation = nullptr; + + if (const auto* beacon = std::get_if(&frame)) + { + erpInformation = &beacon->GetErpInformation(); + } + else if (const auto* probe = std::get_if(&frame)) + { + erpInformation = &probe->GetErpInformation(); + } + // lambda processing Information Elements included in all frame types auto commonOps = [&](auto&& frame) { const CapabilityInformation& capabilities = frame.GetCapabilities(); @@ -1210,11 +1222,10 @@ StaWifiMac::UpdateApInfo(const MgtFrameType& frame, } bool isShortPreambleEnabled = capabilities.IsShortPreamble(); - if (const auto& erpInformation = frame.GetErpInformation(); - erpInformation.has_value() && GetErpSupported(linkId)) + if (erpInformation && erpInformation->has_value() && GetErpSupported(linkId)) { - isShortPreambleEnabled &= !erpInformation->GetBarkerPreambleMode(); - if (erpInformation->GetUseProtection() != 0) + isShortPreambleEnabled &= !(*erpInformation)->GetBarkerPreambleMode(); + if ((*erpInformation)->GetUseProtection() != 0) { GetWifiRemoteStationManager(linkId)->SetUseNonErpProtection(true); }