]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Include the mandatory part of MCS of HE Capabilities in struct
authorHenry Yen <henryyen@google.com>
Thu, 16 Oct 2025 16:11:03 +0000 (16:11 +0000)
committerJouni Malinen <j@w1.fi>
Tue, 9 Dec 2025 10:40:33 +0000 (12:40 +0200)
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 <sunilravi@google.com>
Signed-off-by: Henry Yen <henryyen@google.com>
src/ap/ieee802_11_he.c
src/common/ieee802_11_defs.h

index 01bcd75cf25b0518e781e891e3ba164022d2eabf..731212f19071d7d330e268c184af2c67c645e7b7 100644 (file)
@@ -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]);
 
index 46373b3c23d7556d9710ab8d1e4a129d343ea56f..c9377d2074ed7fe7032a5d3ee21878ac39bf7b80 100644 (file)
@@ -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)