[PATCH] hostapd: Fix build without CONFIG_IEEE80211AX/BE
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Mon Nov 23 07:59:51 PST 2026
hostapd_maxnss() and hostapd_ap_maxnss() use he_oper_chwidth and
eht_oper_chwidth from struct hostapd_config, but these members exist
only with CONFIG_IEEE80211AX and CONFIG_IEEE80211BE, respectively. As a
result, hostapd and wpa_supplicant with CONFIG_AP fail to build without
these options (e.g., the empty, internal and p2p configurations in
tests/build).
Guard the HE and EHT parts with the matching build options and move the
variables used only there into these blocks.
Fixes: ad4cfd771aa8 ("hostapd: Extend hostapd_maxnss() for HE and EHT stations")
Fixes: ce9f0f4a4052 ("hostapd: Report AP max NSS in STATUS control interface response")
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
hostapd/ctrl_iface.c | 18 +++++++++++++-----
src/ap/ctrl_iface_ap.c | 23 +++++++++++++++--------
2 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 12a9bc9342..c53827e29f 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -2825,13 +2825,11 @@ static int hostapd_ctrl_iface_color_change(struct hostapd_iface *iface,
static u8 hostapd_maxnss(struct hostapd_data *hapd, struct sta_info *sta)
{
- u8 rx_nss, max_nss = 1, nss;
- u8 mcs_count;
+ u8 rx_nss, max_nss = 1;
u16 mcs_map;
u8 mcs;
const u8 *mcs_set;
- const u16 *he_mcs_set;
- int i, j;
+ int i;
if (sta->ht_capabilities && (sta->flags & WLAN_STA_HT)) {
mcs_set = sta->ht_capabilities->supported_mcs_set;
@@ -2855,7 +2853,12 @@ static u8 hostapd_maxnss(struct hostapd_data *hapd, struct sta_info *sta)
}
}
+#ifdef CONFIG_IEEE80211AX
if (sta->he_capab && (sta->flags & WLAN_STA_HE)) {
+ const u16 *he_mcs_set;
+ u8 mcs_count;
+ int j;
+
switch (hapd->iface->conf->he_oper_chwidth) {
case CONF_OPER_CHWIDTH_80P80MHZ:
mcs_count = 3;
@@ -2882,9 +2885,13 @@ static u8 hostapd_maxnss(struct hostapd_data *hapd, struct sta_info *sta)
}
}
}
+#endif /* CONFIG_IEEE80211AX */
+#ifdef CONFIG_IEEE80211BE
if (sta->eht_capab && (sta->flags & WLAN_STA_EHT)) {
- mcs_count = 1;
+ u8 mcs_count = 1;
+ u8 nss;
+
switch (hapd->iface->conf->eht_oper_chwidth) {
case CONF_OPER_CHWIDTH_320MHZ:
mcs_count++;
@@ -2905,6 +2912,7 @@ static u8 hostapd_maxnss(struct hostapd_data *hapd, struct sta_info *sta)
max_nss = nss;
}
}
+#endif /* CONFIG_IEEE80211BE */
return max_nss;
}
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 7c5b7c4a06..ccf3a8e203 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -813,14 +813,11 @@ int hostapd_ctrl_iface_poll_sta(struct hostapd_data *hapd,
static u8 hostapd_ap_maxnss(struct hostapd_data *hapd)
{
struct hostapd_hw_modes *mode = hapd->iface->current_mode;
- struct hostapd_config *conf = hapd->iface->conf;
- u8 rx_nss, max_nss = 1, nss;
- u8 mcs_count;
+ u8 rx_nss, max_nss = 1;
u16 mcs_map;
u8 mcs;
const u8 *mcs_set;
- const u16 *he_mcs_set;
- int i, j;
+ int i;
if (!mode)
return max_nss;
@@ -847,8 +844,13 @@ static u8 hostapd_ap_maxnss(struct hostapd_data *hapd)
}
}
+#ifdef CONFIG_IEEE80211AX
if (hostapd_is_he_enabled(hapd)) {
- switch (conf->he_oper_chwidth) {
+ const u16 *he_mcs_set;
+ u8 mcs_count;
+ int j;
+
+ switch (hapd->iface->conf->he_oper_chwidth) {
case CONF_OPER_CHWIDTH_80P80MHZ:
mcs_count = 3;
break;
@@ -875,10 +877,14 @@ static u8 hostapd_ap_maxnss(struct hostapd_data *hapd)
}
}
}
+#endif /* CONFIG_IEEE80211AX */
+#ifdef CONFIG_IEEE80211BE
if (hostapd_is_eht_enabled(hapd)) {
- mcs_count = 1;
- switch (conf->eht_oper_chwidth) {
+ u8 mcs_count = 1;
+ u8 nss;
+
+ switch (hapd->iface->conf->eht_oper_chwidth) {
case CONF_OPER_CHWIDTH_320MHZ:
mcs_count++;
/* fallthrough */
@@ -898,6 +904,7 @@ static u8 hostapd_ap_maxnss(struct hostapd_data *hapd)
max_nss = nss;
}
}
+#endif /* CONFIG_IEEE80211BE */
return max_nss;
}
--
2.34.1
More information about the Hostap
mailing list