diff mbox series

[2/4] hostapd: Add require_eht configuration

Message ID 20221204094935.107862-2-andrei.otcheretianski@intel.com
State Changes Requested
Headers show
Series [1/4] hostapd: Add require_he configuration | expand

Commit Message

Andrei Otcheretianski Dec. 4, 2022, 9:49 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Add the ability to require EHT, advertising that via the
BSS membership selector as well as rejecting association
without EHT.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
---
 hostapd/config_file.c        |  2 ++
 hostapd/hostapd.conf         |  3 +++
 src/ap/ap_config.h           |  1 +
 src/ap/ieee802_11.c          | 30 ++++++++++++++++++++++++++++++
 src/common/ieee802_11_defs.h |  2 ++
 5 files changed, 38 insertions(+)

Comments

Jouni Malinen Dec. 16, 2022, 6:14 p.m. UTC | #1
On Sun, Dec 04, 2022 at 11:49:33AM +0200, Andrei Otcheretianski wrote:
> Add the ability to require EHT, advertising that via the
> BSS membership selector as well as rejecting association
> without EHT.

> +#define BSS_MEMBERSHIP_SELECTOR_EHT_PHY 121

Has that value been assigned yet? IEEE P802.11be/D2.3 indicates this to
be "<Last assigned - 1>" and for some reason, the BSS membership
selector values do not seem to included in the ANA database, so this
would need to be added by the P802.11be editor at some point once the
draft gets sufficiently stable for that.

I don't think I can apply this (and 4/4) at this point since there is a
risk of the value being something else than 121 should another amendment
end up getting a value assigned first.
Andrei Otcheretianski Dec. 19, 2022, 2:28 p.m. UTC | #2
> > +#define BSS_MEMBERSHIP_SELECTOR_EHT_PHY 121
> 
> Has that value been assigned yet? IEEE P802.11be/D2.3 indicates this to be
> "<Last assigned - 1>" and for some reason, the BSS membership selector
> values do not seem to included in the ANA database, so this would need to
> be added by the P802.11be editor at some point once the draft gets
> sufficiently stable for that.
> 
> I don't think I can apply this (and 4/4) at this point since there is a risk of the
> value being something else than 121 should another amendment end up
> getting a value assigned first.

Sure, I will resend it when the value will be final.

> 
> --
> Jouni Malinen                                            PGP id EFC895FA
diff mbox series

Patch

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index bde81c8b42..7c21ffd599 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4734,6 +4734,8 @@  static int hostapd_config_fill(struct hostapd_config *conf,
 #ifdef CONFIG_IEEE80211BE
 	} else if (os_strcmp(buf, "ieee80211be") == 0) {
 		conf->ieee80211be = atoi(pos);
+	} else if (os_strcmp(buf, "require_eht") == 0) {
+		conf->require_eht = atoi(pos);
 	} else if (os_strcmp(buf, "eht_oper_chwidth") == 0) {
 		conf->eht_oper_chwidth = atoi(pos);
 	} else if (os_strcmp(buf, "eht_oper_centr_freq_seg0_idx") == 0) {
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index c5e74a6a2b..460db46c7c 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -1000,6 +1000,9 @@  wmm_ac_vo_acm=0
 # 1 = enabled
 #ieee80211be=1
 
+# Require stations to support EHT PHY (reject association if they do not)
+#require_eht=1
+
 #disable_11be: Boolean (0/1) to disable EHT for a specific BSS
 #disable_11be=0
 
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 86bc2e759d..c94ba46a59 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1141,6 +1141,7 @@  struct hostapd_config {
 	enum oper_chan_width eht_oper_chwidth;
 	u8 eht_oper_centr_freq_seg0_idx;
 	struct eht_phy_capabilities_info eht_phy_capab;
+	int require_eht;
 #endif /* CONFIG_IEEE80211BE */
 
 	/* EHT enable/disable config from CHAN_SWITCH */
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 2ac19006a4..132ac3bb68 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -118,6 +118,10 @@  u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
 #ifdef CONFIG_IEEE80211AX
 	if (hapd->iconf->ieee80211ax && hapd->iconf->require_he)
 		num++;
+#endif
+#ifdef CONFIG_IEEE80211BE
+	if (hapd->iconf->ieee80211be && hapd->iconf->require_eht)
+		num++;
 #endif
 	h2e_required = (hapd->conf->sae_pwe == SAE_PWE_HASH_TO_ELEMENT ||
 			hostapd_sae_pw_id_in_use(hapd->conf) == 2) &&
@@ -158,6 +162,13 @@  u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
 	}
 #endif
 
+#ifdef CONFIG_IEEE80211BE
+	if (hapd->iconf->ieee80211be && hapd->iconf->require_eht && count < 8) {
+		count++;
+		*pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_EHT_PHY;
+	}
+#endif
+
 	if (h2e_required && count < 8) {
 		count++;
 		*pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY;
@@ -185,6 +196,10 @@  u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid)
 #ifdef CONFIG_IEEE80211AX
 	if (hapd->iconf->ieee80211ax && hapd->iconf->require_he)
 		num++;
+#endif
+#ifdef CONFIG_IEEE80211BE
+	if (hapd->iconf->ieee80211be && hapd->iconf->require_eht)
+		num++;
 #endif
 	h2e_required = (hapd->conf->sae_pwe == SAE_PWE_HASH_TO_ELEMENT ||
 			hostapd_sae_pw_id_in_use(hapd->conf) == 2) &&
@@ -229,6 +244,14 @@  u8 * hostapd_eid_ext_supp_rates(struct hostapd_data *hapd, u8 *eid)
 	}
 #endif
 
+#ifdef CONFIG_IEEE80211BE
+	if (hapd->iconf->ieee80211be && hapd->iconf->require_eht) {
+		count++;
+		if (count > 8)
+			*pos++ = 0x80 | BSS_MEMBERSHIP_SELECTOR_EHT_PHY;
+	}
+#endif
+
 	if (h2e_required) {
 		count++;
 		if (count > 8)
@@ -3759,6 +3782,13 @@  static int check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
 					  elems.eht_capabilities_len);
 		if (resp != WLAN_STATUS_SUCCESS)
 			return resp;
+
+		if (hapd->iconf->require_eht && !(sta->flags & WLAN_STA_EHT)) {
+			hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+				       HOSTAPD_LEVEL_INFO, "Station does not support "
+				       "mandatory EHT PHY - reject association");
+			return WLAN_STATUS_DENIED_EHT_NOT_SUPPORTED;
+		}
 	}
 #endif /* CONFIG_IEEE80211BE */
 
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 6f8332af65..4e383bdf85 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -209,6 +209,7 @@ 
 #define WLAN_STATUS_DENIED_HE_NOT_SUPPORTED 124
 #define WLAN_STATUS_SAE_HASH_TO_ELEMENT 126
 #define WLAN_STATUS_SAE_PK 127
+#define WLAN_STATUS_DENIED_EHT_NOT_SUPPORTED 135
 
 /* Reason codes (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45) */
 #define WLAN_REASON_UNSPECIFIED 1
@@ -1293,6 +1294,7 @@  struct ieee80211_ampe_ie {
 #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
 #define BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY 123
 #define BSS_MEMBERSHIP_SELECTOR_HE_PHY 122
+#define BSS_MEMBERSHIP_SELECTOR_EHT_PHY 121
 
 /* VHT Defines */
 #define VHT_CAP_MAX_MPDU_LENGTH_7991                ((u32) BIT(0))