]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Add require_he configuration
authorJohannes Berg <johannes.berg@intel.com>
Sun, 4 Dec 2022 09:49:32 +0000 (11:49 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 16 Dec 2022 18:31:14 +0000 (20:31 +0200)
Add the ability to require HE, advertising that via the
BSS membership selector as well as rejecting association
without HE.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/ieee802_11.c
src/common/ieee802_11_defs.h

index b5393fd6c7700a54ed4d062ba2c388178bb07afc..76f9cf8311f2a72069c527d97767450a5fbb7978 100644 (file)
@@ -3481,6 +3481,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 #ifdef CONFIG_IEEE80211AX
        } else if (os_strcmp(buf, "ieee80211ax") == 0) {
                conf->ieee80211ax = atoi(pos);
+       } else if (os_strcmp(buf, "require_he") == 0) {
+               conf->require_he = atoi(pos);
        } else if (os_strcmp(buf, "he_su_beamformer") == 0) {
                conf->he_phy_capab.he_su_beamformer = atoi(pos);
        } else if (os_strcmp(buf, "he_su_beamformee") == 0) {
index 6b9a7d26076d7cb295d369d432bff11cfe564f90..c5e74a6a2b760013910e95ec498b6428b3d474c0 100644 (file)
@@ -812,6 +812,9 @@ wmm_ac_vo_acm=0
 # 1 = enabled
 #ieee80211ax=1
 
+# Require stations to support HE PHY (reject association if they do not)
+#require_he=1
+
 # disable_11ax: Boolean (0/1) to disable HE for a specific BSS
 #disable_11ax=0
 
index 46b7a478163cd77f723879ae41cfc0b5b168b1b7..1631cf2aac97949e9f5bafa5fbcd8dc3f26c3e56 100644 (file)
@@ -1107,6 +1107,7 @@ struct hostapd_config {
        u8 he_6ghz_rx_ant_pat;
        u8 he_6ghz_tx_ant_pat;
        u8 he_6ghz_reg_pwr_type;
+       bool require_he;
 #endif /* CONFIG_IEEE80211AX */
 
        /* VHT enable/disable config from CHAN_SWITCH */
index 41a0d66a686c0d997c83c5d2ad56297f914b7a29..490dbcbe987292e5b530cf0736e24716652dedc6 100644 (file)
@@ -115,6 +115,10 @@ u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
                num++;
        if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht)
                num++;
+#ifdef CONFIG_IEEE80211AX
+       if (hapd->iconf->ieee80211ax && hapd->iconf->require_he)
+               num++;
+#endif /* CONFIG_IEEE80211AX */
        h2e_required = (hapd->conf->sae_pwe == SAE_PWE_HASH_TO_ELEMENT ||
                        hostapd_sae_pw_id_in_use(hapd->conf) == 2) &&
                hapd->conf->sae_pwe != SAE_PWE_FORCE_HUNT_AND_PECK &&
@@ -147,6 +151,13 @@ u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
                *pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_VHT_PHY;
        }
 
+#ifdef CONFIG_IEEE80211AX
+       if (hapd->iconf->ieee80211ax && hapd->iconf->require_he && count < 8) {
+               count++;
+               *pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_HE_PHY;
+       }
+#endif /* CONFIG_IEEE80211AX */
+
        if (h2e_required && count < 8) {
                count++;
                *pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY;
@@ -171,6 +182,10 @@ u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid)
                num++;
        if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht)
                num++;
+#ifdef CONFIG_IEEE80211AX
+       if (hapd->iconf->ieee80211ax && hapd->iconf->require_he)
+               num++;
+#endif /* CONFIG_IEEE80211AX */
        h2e_required = (hapd->conf->sae_pwe == SAE_PWE_HASH_TO_ELEMENT ||
                        hostapd_sae_pw_id_in_use(hapd->conf) == 2) &&
                hapd->conf->sae_pwe != SAE_PWE_FORCE_HUNT_AND_PECK &&
@@ -206,6 +221,14 @@ u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid)
                        *pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_VHT_PHY;
        }
 
+#ifdef CONFIG_IEEE80211AX
+       if (hapd->iconf->ieee80211ax && hapd->iconf->require_he) {
+               count++;
+               if (count > 8)
+                       *pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_HE_PHY;
+       }
+#endif /* CONFIG_IEEE80211AX */
+
        if (h2e_required) {
                count++;
                if (count > 8)
@@ -3704,6 +3727,15 @@ static int check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
                                         elems.he_capabilities_len);
                if (resp != WLAN_STATUS_SUCCESS)
                        return resp;
+
+               if (hapd->iconf->require_he && !(sta->flags & WLAN_STA_HE)) {
+                       hostapd_logger(hapd, sta->addr,
+                                      HOSTAPD_MODULE_IEEE80211,
+                                      HOSTAPD_LEVEL_INFO,
+                                      "Station does not support mandatory HE PHY - reject association");
+                       return WLAN_STATUS_DENIED_HE_NOT_SUPPORTED;
+               }
+
                if (is_6ghz_op_class(hapd->iconf->op_class)) {
                        if (!(sta->flags & WLAN_STA_HE)) {
                                hostapd_logger(hapd, sta->addr,
index 6ded79deca7bcdb7ff53f36c57dcdaa75634fa80..93275c03ef2163be374abcc3c3c71df1fd5599a5 100644 (file)
@@ -1289,6 +1289,7 @@ struct ieee80211_ampe_ie {
 #define HT_OPER_PARAM_PCO_PHASE                                ((u16) BIT(11))
 /* B36..B39 - Reserved */
 
+#define BSS_MEMBERSHIP_SELECTOR_HE_PHY 122
 #define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126
 #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
 #define BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY 123