FILS: Fix maximum NSS calculation for FD frame

Maximum NSS calculation assumed the host to be little endian while
retrieving MCS values from HE capabilities which is incorrect. Use
WPA_GET_LE16() instead.

Add a check for HE as the current NSS calculation assumes HE support.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
This commit is contained in:
Aloka Dixit 2023-03-13 02:11:25 -07:00 committed by Jouni Malinen
parent ecae45ff66
commit 903e3a1e62

View file

@ -1410,14 +1410,37 @@ static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd)
cap_info |= phy_index << FD_CAP_PHY_INDEX_SHIFT;
cap_info |= chwidth << FD_CAP_BSS_CHWIDTH_SHIFT;
if (mode) {
u16 *mcs = (u16 *) mode->he_capab[IEEE80211_MODE_AP].mcs;
if (mode && phy_index == FD_CAP_PHY_INDEX_HE) {
const u8 *he_mcs = mode->he_capab[IEEE80211_MODE_AP].mcs;
int i;
u16 nss = 0;
u16 nss = 0, mcs[6];
os_memset(mcs, 0xffff, 6 * sizeof(u16));
if (mcs_nss_size == 4) {
mcs[0] = WPA_GET_LE16(&he_mcs[0]);
mcs[1] = WPA_GET_LE16(&he_mcs[2]);
}
if (mcs_nss_size == 8) {
mcs[2] = WPA_GET_LE16(&he_mcs[4]);
mcs[3] = WPA_GET_LE16(&he_mcs[6]);
}
if (mcs_nss_size == 12) {
mcs[4] = WPA_GET_LE16(&he_mcs[8]);
mcs[5] = WPA_GET_LE16(&he_mcs[10]);
}
for (i = 0; i < HE_NSS_MAX_STREAMS; i++) {
u16 nss_mask = 0x3 << (i * 2);
/*
* If NSS values supported by RX and TX are different
* then choose the smaller of the two as the maximum
* supported NSS as that is the value supported by
* both RX and TX.
*/
if (mcs_nss_size == 4 &&
(((mcs[0] & nss_mask) == nss_mask) ||
((mcs[1] & nss_mask) == nss_mask)))