wifi: Fix getting p80 channel number in 6 GHz band

This commit is contained in:
Stefano Avallone
2023-03-04 18:46:25 +01:00
parent 2877f9cc70
commit 1f54892b7e
2 changed files with 3 additions and 1 deletions

View File

@@ -823,7 +823,7 @@ ApWifiMac::GetVhtOperation(uint8_t linkId) const
// segment that contains the primary channel.
operation.SetChannelCenterFrequencySegment0(
(bssBandwidth == 160)
? phy->GetOperatingChannel().GetPrimaryChannelNumber(80, WIFI_STANDARD_80211ac)
? phy->GetOperatingChannel().GetPrimaryChannelNumber(80, phy->GetStandard())
: phy->GetChannelNumber());
// For a 20, 40, or 80 MHz BSS bandwidth, this subfield is set to 0.
// For a 160 MHz BSS bandwidth and the Channel Width subfield equal to 1,

View File

@@ -512,8 +512,10 @@ WifiPhyOperatingChannel::GetPrimaryChannelNumber(uint16_t primaryChannelWidth,
WifiStandard standard) const
{
auto frequency = GetPrimaryChannelCenterFrequency(primaryChannelWidth);
NS_ASSERT_MSG(IsSet(), "No channel set");
auto& [chanNumber, centerFreq, channelWidth, channelType, band] = *m_channelIt;
auto primaryChanIt = FindFirst(0, frequency, primaryChannelWidth, standard, band);
NS_ASSERT_MSG(primaryChanIt != m_frequencyChannels.end(), "Primary channel number not found");
return std::get<0>(*primaryChanIt);
}