From 1b33c9daae3a2d0499a4fa3d649d2a57ae742318 Mon Sep 17 00:00:00 2001 From: Shreyas Sheth Date: Thu, 17 Apr 2025 18:24:26 +0530 Subject: [PATCH] fix(esp_wifi): Resolve comments for wpa3 compatible mode --- .../esp_wifi/include/esp_wifi_types_generic.h | 2 +- components/wpa_supplicant/src/ap/ap_config.h | 2 +- components/wpa_supplicant/src/ap/wpa_auth_ie.c | 6 ++---- .../wpa_supplicant/src/common/wpa_common.c | 2 +- components/wpa_supplicant/src/rsn_supp/wpa.c | 16 ++++++++-------- .../softAP/main/softap_example_main.c | 2 +- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index c82809d8a4..2fb7404771 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -535,7 +535,7 @@ typedef struct { wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method */ uint8_t transition_disable: 1; /**< Whether to enable transition disable feature */ uint8_t sae_ext: 1; /**< Enable SAE EXT feature. SOC_GCMP_SUPPORT is required for this feature. */ - uint8_t wpa3_compatible_mode: 1; /**< Whether to enable wpa3 compatible authmode feature */ + uint8_t wpa3_compatible_mode: 1; /**< Enable WPA3 compatible authmode feature. Note: Enabling this will override the AP configuration's authmode and pairwise_cipher. The AP will operate as a WPA2 access point for legacy stations and as a WPA3 access point for WPA3 compatible stations. */ uint8_t reserved: 5; /**< Reserved for future feature set */ wifi_bss_max_idle_config_t bss_max_idle_cfg; /**< Configuration for bss max idle, effective if CONFIG_WIFI_BSS_MAX_IDLE_SUPPORT is enabled */ uint16_t gtk_rekey_interval; /**< GTK rekeying interval in seconds. If set to 0, GTK rekeying is disabled. Range: 60 ~ 65535 including 0. */ diff --git a/components/wpa_supplicant/src/ap/ap_config.h b/components/wpa_supplicant/src/ap/ap_config.h index 5d848d9421..6ee3d5729c 100644 --- a/components/wpa_supplicant/src/ap/ap_config.h +++ b/components/wpa_supplicant/src/ap/ap_config.h @@ -310,7 +310,7 @@ struct hostapd_bss_config { int *sae_groups; #define SAE_ANTI_CLOGGING_THRESHOLD 2 /* max number of commit msg allowed to queue without anti-clogging token request */ - int rsn_override_omit_rsnxe; + int rsn_override_omit_rsnxe; }; diff --git a/components/wpa_supplicant/src/ap/wpa_auth_ie.c b/components/wpa_supplicant/src/ap/wpa_auth_ie.c index ed34241985..d7ccf86a0c 100644 --- a/components/wpa_supplicant/src/ap/wpa_auth_ie.c +++ b/components/wpa_supplicant/src/ap/wpa_auth_ie.c @@ -457,7 +457,7 @@ static int wpa_write_rsnxe_override(struct wpa_auth_config *conf, u8 *buf, int wpa_auth_gen_wpa_ie(struct wpa_authenticator *wpa_auth) { - u8 *pos, buf[256]; + u8 *pos, buf[128]; int res; pos = buf; @@ -475,8 +475,6 @@ int wpa_auth_gen_wpa_ie(struct wpa_authenticator *wpa_auth) res = wpa_write_rsnxe(&wpa_auth->conf, pos, buf + sizeof(buf) - pos); - res = wpa_write_rsnxe(&wpa_auth->conf, pos, - buf + sizeof(buf) - pos); if (res < 0) return res; pos += res; @@ -507,7 +505,7 @@ int wpa_auth_gen_wpa_ie(struct wpa_authenticator *wpa_auth) pos += res; } - if ((wpa_auth->conf.wpa & WPA_PROTO_RSN) && + if ((wpa_auth->conf.wpa & WPA_PROTO_RSN) && (wpa_auth->conf.rsn_override_key_mgmt)) { res = wpa_write_rsnxe_override(&wpa_auth->conf, pos, buf + sizeof(buf) - pos); diff --git a/components/wpa_supplicant/src/common/wpa_common.c b/components/wpa_supplicant/src/common/wpa_common.c index 1aa4db2dca..b4cc3f58b2 100644 --- a/components/wpa_supplicant/src/common/wpa_common.c +++ b/components/wpa_supplicant/src/common/wpa_common.c @@ -1700,7 +1700,7 @@ int wpa_parse_kde_ies(const u8 *buf, size_t len, struct wpa_eapol_ie_parse *ie) const u8 *pos, *end; int ret = 0; - memset(ie, 0, sizeof(*ie)); + os_memset(ie, 0, sizeof(*ie)); for (pos = buf, end = pos + len; pos + 1 < end; pos += 2 + pos[1]) { if (pos[0] == 0xdd && ((pos == buf + len - 1) || pos[1] == 0)) { diff --git a/components/wpa_supplicant/src/rsn_supp/wpa.c b/components/wpa_supplicant/src/rsn_supp/wpa.c index 5161327c8a..e6363fc3b2 100644 --- a/components/wpa_supplicant/src/rsn_supp/wpa.c +++ b/components/wpa_supplicant/src/rsn_supp/wpa.c @@ -2282,14 +2282,14 @@ int wpa_sm_set_param(struct wpa_sm *sm, enum wpa_sm_conf_params param, return -1; switch (param) { - case WPA_PARAM_RSN_OVERRIDE: - sm->rsn_override = value; - break; - case WPA_PARAM_RSN_OVERRIDE_SUPPORT: - sm->rsn_override_support = value; - break; - default: - break; + case WPA_PARAM_RSN_OVERRIDE: + sm->rsn_override = value; + break; + case WPA_PARAM_RSN_OVERRIDE_SUPPORT: + sm->rsn_override_support = value; + break; + default: + break; } return ret; } diff --git a/examples/wifi/getting_started/softAP/main/softap_example_main.c b/examples/wifi/getting_started/softAP/main/softap_example_main.c index f4baa2052a..3543538693 100644 --- a/examples/wifi/getting_started/softAP/main/softap_example_main.c +++ b/examples/wifi/getting_started/softAP/main/softap_example_main.c @@ -78,7 +78,7 @@ void wifi_init_softap(void) #else /* CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT */ .authmode = WIFI_AUTH_WPA2_PSK, #endif - .wpa3_compatible_mode = 1, + .wpa3_compatible_mode = 0, .pmf_cfg = { .required = true, },