From e5d15e22541e82597723608dd1ce49dda088de8d Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 17 Oct 2022 11:12:17 +0300 Subject: [PATCH] EHT: Allow EHT to be disabled using disable_eht=1 in wpa_supplicant This is similar to the previously added disable_ht/vht/he parameters. Signed-off-by: Jouni Malinen --- src/drivers/driver.h | 5 +++++ src/drivers/driver_nl80211.c | 6 ++++++ wpa_supplicant/config.c | 1 + wpa_supplicant/config_file.c | 1 + wpa_supplicant/config_ssid.h | 8 ++++++++ wpa_supplicant/sme.c | 1 + wpa_supplicant/wpa_cli.c | 1 + wpa_supplicant/wpa_supplicant.c | 12 ++++++++++++ wpa_supplicant/wpa_supplicant.conf | 4 ++++ wpa_supplicant/wpa_supplicant_i.h | 3 +++ 10 files changed, 42 insertions(+) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 36ecf72f6..4d9a7e3c0 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1251,6 +1251,11 @@ struct wpa_driver_associate_params { * 2 = both hunting-and-pecking loop and hash-to-element enabled */ int sae_pwe; + + /** + * disable_eht - Disable EHT for this connection + */ + int disable_eht; }; enum hide_ssid { diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ed9bf4841..fdc773a58 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -6059,6 +6059,12 @@ static int nl80211_ht_vht_overrides(struct nl_msg *msg, } #endif /* CONFIG_HE_OVERRIDES */ + if (params->disable_eht) { + wpa_printf(MSG_DEBUG, " * EHT disabled"); + if (nla_put_flag(msg, NL80211_ATTR_DISABLE_EHT)) + return -1; + } + return 0; } diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index a91c689d0..7bad144da 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2664,6 +2664,7 @@ static const struct parse_data ssid_fields[] = { { INT_RANGE(beacon_prot, 0, 1) }, { INT_RANGE(transition_disable, 0, 255) }, { INT_RANGE(sae_pk, 0, 2) }, + { INT_RANGE(disable_eht, 0, 1)}, }; #undef OFFSET diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index b637dbfbc..c9936d18b 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -880,6 +880,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) #ifdef CONFIG_HE_OVERRIDES INT(disable_he); #endif /* CONFIG_HE_OVERRIDES */ + INT(disable_eht); #undef STR #undef INT diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index f625a0cc3..a8a81d79b 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -1192,6 +1192,14 @@ struct wpa_ssid { * 2 = both hunting-and-pecking loop and hash-to-element enabled */ int sae_pwe; + + /** + * disable_eht - Disable EHT (IEEE 802.11be) for this network + * + * By default, use it if it is available, but this can be configured + * to 1 to have it disabled. + */ + int disable_eht; }; #endif /* CONFIG_SSID_H */ diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index c9473947a..896fa9df4 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -2027,6 +2027,7 @@ mscs_fail: #ifdef CONFIG_HE_OVERRIDES wpa_supplicant_apply_he_overrides(wpa_s, ssid, ¶ms); #endif /* CONFIG_HE_OVERRIDES */ + wpa_supplicant_apply_eht_overrides(wpa_s, ssid, ¶ms); #ifdef CONFIG_IEEE80211R if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies && get_ie(wpa_s->sme.ft_ies, wpa_s->sme.ft_ies_len, diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index 197efe0b7..4cc0857c6 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -1479,6 +1479,7 @@ static const char *network_fields[] = { #ifdef CONFIG_HE_OVERRIDES "disable_he", #endif /* CONFIG_HE_OVERRIDES */ + "disable_eht", "ap_max_inactivity", "dtim_period", "beacon_int", #ifdef CONFIG_MACSEC "macsec_policy", diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 761017248..3d7626aeb 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -4119,6 +4119,7 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) #ifdef CONFIG_HE_OVERRIDES wpa_supplicant_apply_he_overrides(wpa_s, ssid, ¶ms); #endif /* CONFIG_HE_OVERRIDES */ + wpa_supplicant_apply_eht_overrides(wpa_s, ssid, ¶ms); #ifdef CONFIG_P2P /* @@ -5915,6 +5916,17 @@ void wpa_supplicant_apply_he_overrides( #endif /* CONFIG_HE_OVERRIDES */ +void wpa_supplicant_apply_eht_overrides( + struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, + struct wpa_driver_associate_params *params) +{ + if (!ssid) + return; + + params->disable_eht = ssid->disable_eht; +} + + static int pcsc_reader_init(struct wpa_supplicant *wpa_s) { #ifdef PCSC_FUNCS diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf index 90061ba67..cd3e16df9 100644 --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf @@ -1627,6 +1627,10 @@ fast_reauth=1 # 2: MCS 0-9 # 3: not supported +# disable_eht: Whether EHT should be disabled. +# 0 = EHT enabled (if supported) (default) +# 1 = EHT disabled + # multi_ap_backhaul_sta: Multi-AP backhaul STA functionality # 0 = normal STA (default) # 1 = backhaul STA diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 813e5ac1b..4081592bd 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1584,6 +1584,9 @@ void wpa_supplicant_apply_vht_overrides( void wpa_supplicant_apply_he_overrides( struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, struct wpa_driver_associate_params *params); +void wpa_supplicant_apply_eht_overrides( + struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, + struct wpa_driver_associate_params *params); int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,