wifi: There is no ERP Information in AssocResp frames

This commit is contained in:
Stefano Avallone
2023-03-28 12:23:43 +02:00
committed by Stefano Avallone
parent e74ffdff6d
commit fda9fc490d
4 changed files with 15 additions and 56 deletions

View File

@@ -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));

View File

@@ -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<ErpInformation>&
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);

View File

@@ -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<ErpInformation>& 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<HtOperation> m_htOperation; //!< HT operation
std::optional<VhtCapabilities> m_vhtCapability; //!< VHT capabilities
std::optional<VhtOperation> m_vhtOperation; //!< VHT operation
std::optional<ErpInformation> m_erpInformation; //!< ERP information
std::optional<EdcaParameterSet> m_edcaParameterSet; //!< EDCA Parameter Set
std::optional<HeCapabilities> m_heCapability; //!< HE capabilities
std::optional<HeOperation> m_heOperation; //!< HE operation

View File

@@ -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>* erpInformation = nullptr;
if (const auto* beacon = std::get_if<MgtBeaconHeader>(&frame))
{
erpInformation = &beacon->GetErpInformation();
}
else if (const auto* probe = std::get_if<MgtProbeResponseHeader>(&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);
}