From: Henry Yen Date: Thu, 16 Oct 2025 16:11:03 +0000 (+0000) Subject: Include the mandatory part of MCS of HE Capabilities in struct X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2bcaf2b1d002b6703fe7bf722fcb529d8685d17;p=thirdparty%2Fhostap.git Include the mandatory part of MCS of HE Capabilities in struct struct ieee80211_he_capabilities included the first four octets of the Supported HE-MCS And NSS Set field in the optional[] array. However, those four octets are actually required to be present. Add them as mandatory fields into the struct to match the minimum set of fields and to make them somewhat more convenient for parsing purposes. Signed-off-by: sunilravi Signed-off-by: Henry Yen --- diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c index 01bcd75cf..731212f19 100644 --- a/src/ap/ieee802_11_he.c +++ b/src/ap/ieee802_11_he.c @@ -70,7 +70,8 @@ static int ieee80211_invalid_he_cap_size(const u8 *buf, size_t len) u8 ppe_thres_hdr; cap = (struct ieee80211_he_capabilities *) buf; - cap_len = sizeof(*cap) - sizeof(cap->optional); + cap_len = sizeof(cap->he_mac_capab_info) + + sizeof(cap->he_phy_capab_info); if (len < cap_len) return 1; @@ -94,6 +95,7 @@ u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid, const struct he_capabilities *he_capab; u8 *pos = eid; u8 ie_size = 0, mcs_nss_size, ppet_size; + u8 *epos; if (!mode) return eid; @@ -117,11 +119,12 @@ u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid, HE_MAX_MAC_CAPAB_SIZE); os_memcpy(cap->he_phy_capab_info, he_capab->phy_cap, HE_MAX_PHY_CAPAB_SIZE); - os_memcpy(cap->optional, he_capab->mcs, mcs_nss_size); + epos = (u8 *) &cap->he_basic_supported_mcs_set; + os_memcpy(epos, he_capab->mcs, mcs_nss_size); + epos += mcs_nss_size; if (ppet_size) - os_memcpy(&cap->optional[mcs_nss_size], he_capab->ppet, - ppet_size); + os_memcpy(epos, he_capab->ppet, ppet_size); if (hapd->iface->conf->he_phy_capab.he_su_beamformer) cap->he_phy_capab_info[HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX] |= @@ -411,14 +414,15 @@ static int check_valid_he_mcs(struct hostapd_data *hapd, const u8 *sta_he_capab, { u16 sta_rx_mcs_set, ap_tx_mcs_set; u8 mcs_count = 0; - const u16 *ap_mcs_set, *sta_mcs_set; + const u16 *ap_mcs_set; + const u8 *sta_mcs_set; int i; if (!hapd->iface->current_mode) return 1; ap_mcs_set = (u16 *) hapd->iface->current_mode->he_capab[opmode].mcs; - sta_mcs_set = (u16 *) ((const struct ieee80211_he_capabilities *) - sta_he_capab)->optional; + sta_mcs_set = (const u8 *) &((const struct ieee80211_he_capabilities *) + sta_he_capab)->he_basic_supported_mcs_set; /* * Disable HE capabilities for STAs for which there is not even a single @@ -442,7 +446,7 @@ static int check_valid_he_mcs(struct hostapd_data *hapd, const u8 *sta_he_capab, int j; /* AP Tx MCS map vs. STA Rx MCS map */ - sta_rx_mcs_set = WPA_GET_LE16((const u8 *) &sta_mcs_set[i * 2]); + sta_rx_mcs_set = WPA_GET_LE16(&sta_mcs_set[i * 4]); ap_tx_mcs_set = WPA_GET_LE16((const u8 *) &ap_mcs_set[(i * 2) + 1]); diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 46373b3c2..c9377d207 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -2456,9 +2456,16 @@ enum nr_chan_width { struct ieee80211_he_capabilities { u8 he_mac_capab_info[6]; u8 he_phy_capab_info[11]; - /* Followed by 4, 8, or 12 octets of Supported HE-MCS And NSS Set field - * and optional variable length PPE Thresholds field. */ - u8 optional[37]; + /* Supported HE-MCS And NSS Set field */ + struct { + le16 rx_map; /* Rx HE-MCS Map <= 80 MHz */ + le16 tx_map; /* Tx HE-MCS Map <= 80 MHz */ + /* Followed by 0, 4, or 8 octets of optional Rx/Tx HE-MCS maps + * for 160 MHz and 80+80 MHz. These are included in the + * optional[] below. */ + } he_basic_supported_mcs_set; + /* Followed by optional variable length PPE Thresholds field. */ + u8 optional[33]; } STRUCT_PACKED; #define IEEE80211_HE_CAPAB_MIN_LEN (6 + 11)