developer | 1d9da7d | 2023-04-15 12:45:34 +0800 | [diff] [blame] | 1 | From f9d768d2a7ee7196a67eddf64f30e188f53b9785 Mon Sep 17 00:00:00 2001 |
developer | 24a77e3 | 2023-03-22 18:02:16 +0800 | [diff] [blame] | 2 | From: Amit Khatri <amit.khatri@mediatek.com> |
| 3 | Date: Thu, 23 Mar 2023 14:26:46 +0800 |
developer | 1d9da7d | 2023-04-15 12:45:34 +0800 | [diff] [blame] | 4 | Subject: [PATCH 24/26] hostapd: mtk: Add support for masking EHT capabilities. |
developer | 24a77e3 | 2023-03-22 18:02:16 +0800 | [diff] [blame] | 5 | |
| 6 | If STA want to disable EHT mode connection. |
| 7 | STA can set |
| 8 | disable_eht=1 in netowrk bloack of AP configuration. |
| 9 | e.g. |
| 10 | wpa_cli -iapcli0 set_network 0 disable_eht=1 |
| 11 | |
| 12 | It will make EHT capability on driver level. |
| 13 | |
| 14 | Signed-off-by: Amit Khatri <amit.khatri@mediatek.com> |
| 15 | --- |
| 16 | src/drivers/driver.h | 8 ++++++++ |
| 17 | src/drivers/driver_nl80211.c | 9 +++++++++ |
| 18 | src/drivers/nl80211_copy.h | 2 ++ |
| 19 | wpa_supplicant/Makefile | 4 ++++ |
| 20 | wpa_supplicant/config.c | 3 +++ |
| 21 | wpa_supplicant/config_file.c | 3 +++ |
| 22 | wpa_supplicant/config_ssid.h | 11 +++++++++++ |
| 23 | wpa_supplicant/sme.c | 4 ++++ |
| 24 | wpa_supplicant/wpa_cli.c | 3 +++ |
| 25 | wpa_supplicant/wpa_supplicant.c | 15 +++++++++++++++ |
| 26 | wpa_supplicant/wpa_supplicant_i.h | 6 ++++++ |
| 27 | 11 files changed, 68 insertions(+) |
| 28 | |
| 29 | diff --git a/src/drivers/driver.h b/src/drivers/driver.h |
| 30 | index 7f6392f..1bf0cd6 100644 |
| 31 | --- a/src/drivers/driver.h |
| 32 | +++ b/src/drivers/driver.h |
| 33 | @@ -1151,6 +1151,14 @@ struct wpa_driver_associate_params { |
| 34 | int disable_he; |
| 35 | #endif /* CONFIG_HE_OVERRIDES */ |
| 36 | |
| 37 | +#ifdef CONFIG_EHT_OVERRIDES |
| 38 | + /** |
| 39 | + * disable_eht - Disable EHT for this connection |
| 40 | + */ |
| 41 | + int disable_eht; |
| 42 | +#endif /* CONFIG_EHT_OVERRIDES */ |
| 43 | + |
| 44 | + |
| 45 | /** |
| 46 | * req_key_mgmt_offload - Request key management offload for connection |
| 47 | * |
| 48 | diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c |
| 49 | index f9a8763..945ce3e 100644 |
| 50 | --- a/src/drivers/driver_nl80211.c |
| 51 | +++ b/src/drivers/driver_nl80211.c |
| 52 | @@ -6058,6 +6058,15 @@ static int nl80211_ht_vht_overrides(struct nl_msg *msg, |
| 53 | } |
| 54 | #endif /* CONFIG_HE_OVERRIDES */ |
| 55 | |
| 56 | +#ifdef CONFIG_EHT_OVERRIDES |
| 57 | + if (params->disable_eht) { |
| 58 | + wpa_printf(MSG_DEBUG, " * EHT disabled"); |
| 59 | + if (nla_put_flag(msg, NL80211_ATTR_DISABLE_EHT)) |
| 60 | + return -1; |
| 61 | + } |
| 62 | +#endif /* CONFIG_EHT_OVERRIDES */ |
| 63 | + |
| 64 | + |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h |
| 69 | index 0937752..ce8ee58 100644 |
| 70 | --- a/src/drivers/nl80211_copy.h |
| 71 | +++ b/src/drivers/nl80211_copy.h |
| 72 | @@ -3175,6 +3175,8 @@ enum nl80211_attrs { |
| 73 | |
| 74 | NL80211_ATTR_EHT_CAPABILITY, |
| 75 | |
| 76 | + NL80211_ATTR_DISABLE_EHT, |
| 77 | + |
| 78 | /* add attributes here, update the policy in nl80211.c */ |
| 79 | |
| 80 | __NL80211_ATTR_AFTER_LAST, |
| 81 | diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile |
| 82 | index ef36b56..40cdb59 100644 |
| 83 | --- a/wpa_supplicant/Makefile |
| 84 | +++ b/wpa_supplicant/Makefile |
| 85 | @@ -208,6 +208,10 @@ ifdef CONFIG_HE_OVERRIDES |
| 86 | CFLAGS += -DCONFIG_HE_OVERRIDES |
| 87 | endif |
| 88 | |
| 89 | +ifdef CONFIG_EHT_OVERRIDES |
| 90 | +CFLAGS += -DCONFIG_EHT_OVERRIDES |
| 91 | +endif |
| 92 | + |
| 93 | ifndef CONFIG_BACKEND |
| 94 | CONFIG_BACKEND=file |
| 95 | endif |
| 96 | diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c |
| 97 | index f9880ed..994ee5e 100644 |
| 98 | --- a/wpa_supplicant/config.c |
| 99 | +++ b/wpa_supplicant/config.c |
| 100 | @@ -2718,6 +2718,9 @@ static const struct parse_data ssid_fields[] = { |
| 101 | #ifdef CONFIG_HE_OVERRIDES |
| 102 | { INT_RANGE(disable_he, 0, 1)}, |
| 103 | #endif /* CONFIG_HE_OVERRIDES */ |
| 104 | +#ifdef CONFIG_EHT_OVERRIDES |
| 105 | + { INT_RANGE(disable_eht, 0, 1)}, |
| 106 | +#endif /* CONFIG_EHT_OVERRIDES */ |
| 107 | { INT(ap_max_inactivity) }, |
| 108 | { INT(dtim_period) }, |
| 109 | { INT(beacon_int) }, |
| 110 | diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c |
| 111 | index 24c2998..056b265 100644 |
| 112 | --- a/wpa_supplicant/config_file.c |
| 113 | +++ b/wpa_supplicant/config_file.c |
| 114 | @@ -881,6 +881,9 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) |
| 115 | #ifdef CONFIG_HE_OVERRIDES |
| 116 | INT(disable_he); |
| 117 | #endif /* CONFIG_HE_OVERRIDES */ |
| 118 | +#ifdef CONFIG_EHT_OVERRIDES |
| 119 | + INT(disable_eht); |
| 120 | +#endif /* CONFIG_EHT_OVERRIDES */ |
| 121 | |
| 122 | #undef STR |
| 123 | #undef INT |
| 124 | diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h |
| 125 | index 9a389cc..cc9aa8e 100644 |
| 126 | --- a/wpa_supplicant/config_ssid.h |
| 127 | +++ b/wpa_supplicant/config_ssid.h |
| 128 | @@ -810,6 +810,17 @@ struct wpa_ssid { |
| 129 | int disable_he; |
| 130 | #endif /* CONFIG_HE_OVERRIDES */ |
| 131 | |
| 132 | +#ifdef CONFIG_EHT_OVERRIDES |
| 133 | + /** |
| 134 | + * disable_eht - Disable EHT (IEEE 802.11be) for this network |
| 135 | + * |
| 136 | + * By default, use it if it is available, but this can be configured |
| 137 | + * to 1 to have it disabled. |
| 138 | + */ |
| 139 | + int disable_eht; |
| 140 | +#endif /* CONFIG_EHT_OVERRIDES */ |
| 141 | + |
| 142 | + |
| 143 | /** |
| 144 | * ap_max_inactivity - Timeout in seconds to detect STA's inactivity |
| 145 | * |
| 146 | diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c |
| 147 | index 2dad36d..e7aadf6 100644 |
| 148 | --- a/wpa_supplicant/sme.c |
| 149 | +++ b/wpa_supplicant/sme.c |
| 150 | @@ -2001,6 +2001,10 @@ mscs_fail: |
| 151 | #ifdef CONFIG_HE_OVERRIDES |
| 152 | wpa_supplicant_apply_he_overrides(wpa_s, ssid, ¶ms); |
| 153 | #endif /* CONFIG_HE_OVERRIDES */ |
| 154 | +#ifdef CONFIG_EHT_OVERRIDES |
| 155 | + wpa_supplicant_apply_eht_overrides(wpa_s, ssid, ¶ms); |
| 156 | +#endif /* CONFIG_EHT_OVERRIDES */ |
| 157 | + |
| 158 | #ifdef CONFIG_IEEE80211R |
| 159 | if (auth_type == WLAN_AUTH_FT && wpa_s->sme.ft_ies && |
| 160 | get_ie(wpa_s->sme.ft_ies, wpa_s->sme.ft_ies_len, |
| 161 | diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c |
| 162 | index 8443f54..ea251db 100644 |
| 163 | --- a/wpa_supplicant/wpa_cli.c |
| 164 | +++ b/wpa_supplicant/wpa_cli.c |
| 165 | @@ -1476,6 +1476,9 @@ static const char *network_fields[] = { |
| 166 | #ifdef CONFIG_HE_OVERRIDES |
| 167 | "disable_he", |
| 168 | #endif /* CONFIG_HE_OVERRIDES */ |
| 169 | +#ifdef CONFIG_EHT_OVERRIDES |
| 170 | + "disable_eht", |
| 171 | +#endif /* CONFIG_EHT_OVERRIDES */ |
| 172 | "ap_max_inactivity", "dtim_period", "beacon_int", |
| 173 | #ifdef CONFIG_MACSEC |
| 174 | "macsec_policy", |
| 175 | diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c |
developer | 8eb72a3 | 2023-03-30 08:32:07 +0800 | [diff] [blame] | 176 | index 04c37b1..67c801d 100644 |
developer | 24a77e3 | 2023-03-22 18:02:16 +0800 | [diff] [blame] | 177 | --- a/wpa_supplicant/wpa_supplicant.c |
| 178 | +++ b/wpa_supplicant/wpa_supplicant.c |
developer | 8eb72a3 | 2023-03-30 08:32:07 +0800 | [diff] [blame] | 179 | @@ -4084,6 +4084,10 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) |
developer | 24a77e3 | 2023-03-22 18:02:16 +0800 | [diff] [blame] | 180 | #ifdef CONFIG_HE_OVERRIDES |
| 181 | wpa_supplicant_apply_he_overrides(wpa_s, ssid, ¶ms); |
| 182 | #endif /* CONFIG_HE_OVERRIDES */ |
| 183 | +#ifdef CONFIG_EHT_OVERRIDES |
| 184 | + wpa_supplicant_apply_eht_overrides(wpa_s, ssid, ¶ms); |
| 185 | +#endif /* CONFIG_EHT_OVERRIDES */ |
| 186 | + |
| 187 | |
| 188 | #ifdef CONFIG_P2P |
| 189 | /* |
developer | 8eb72a3 | 2023-03-30 08:32:07 +0800 | [diff] [blame] | 190 | @@ -5879,6 +5883,17 @@ void wpa_supplicant_apply_he_overrides( |
developer | 24a77e3 | 2023-03-22 18:02:16 +0800 | [diff] [blame] | 191 | } |
| 192 | #endif /* CONFIG_HE_OVERRIDES */ |
| 193 | |
| 194 | +#ifdef CONFIG_EHT_OVERRIDES |
| 195 | +void wpa_supplicant_apply_eht_overrides( |
| 196 | + struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, |
| 197 | + struct wpa_driver_associate_params *params) |
| 198 | +{ |
| 199 | + if (!ssid) |
| 200 | + return; |
| 201 | + |
| 202 | + params->disable_eht = ssid->disable_eht; |
| 203 | +} |
| 204 | +#endif /* CONFIG_EHT_OVERRIDES */ |
| 205 | |
| 206 | static int pcsc_reader_init(struct wpa_supplicant *wpa_s) |
| 207 | { |
| 208 | diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h |
developer | 1d9da7d | 2023-04-15 12:45:34 +0800 | [diff] [blame] | 209 | index 3285af3..1140360 100644 |
developer | 24a77e3 | 2023-03-22 18:02:16 +0800 | [diff] [blame] | 210 | --- a/wpa_supplicant/wpa_supplicant_i.h |
| 211 | +++ b/wpa_supplicant/wpa_supplicant_i.h |
| 212 | @@ -1576,6 +1576,12 @@ void wpa_supplicant_apply_vht_overrides( |
| 213 | void wpa_supplicant_apply_he_overrides( |
| 214 | struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, |
| 215 | struct wpa_driver_associate_params *params); |
| 216 | +#ifdef CONFIG_EHT_OVERRIDES |
| 217 | +void wpa_supplicant_apply_eht_overrides( |
| 218 | + struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, |
| 219 | + struct wpa_driver_associate_params *params); |
developer | f68ff1a | 2023-04-07 11:38:43 +0800 | [diff] [blame] | 220 | +#endif /* CONFIG_EHT_OVERRIDES */ |
developer | 24a77e3 | 2023-03-22 18:02:16 +0800 | [diff] [blame] | 221 | + |
| 222 | |
| 223 | int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); |
| 224 | int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s, |
| 225 | -- |
| 226 | 2.18.0 |
| 227 | |