From 4b77473982d662041bb9f375e6b3f7275e616fe0 Mon Sep 17 00:00:00 2001 From: jgujarathi Date: Wed, 1 Feb 2023 12:43:01 +0530 Subject: [PATCH 1/3] wpa_supplicant : Correct scan results for GCMP RSN Fixed a typo which was causing scan results for GCMP not showing correctly --- components/wpa_supplicant/src/common/wpa_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/wpa_supplicant/src/common/wpa_common.c b/components/wpa_supplicant/src/common/wpa_common.c index bbcfcaeeae..ba31029b4b 100644 --- a/components/wpa_supplicant/src/common/wpa_common.c +++ b/components/wpa_supplicant/src/common/wpa_common.c @@ -63,7 +63,7 @@ static int rsn_selector_to_bitfield(const u8 *s) return WPA_CIPHER_CCMP; if (RSN_SELECTOR_GET(s) == RSN_CIPHER_SUITE_WEP104) return WPA_CIPHER_WEP104; -#ifdef COFIG_GCMP +#ifdef CONFIG_GCMP if (RSN_SELECTOR_GET(s) == RSN_CIPHER_SUITE_GCMP) return WPA_CIPHER_GCMP; if (RSN_SELECTOR_GET(s) == RSN_CIPHER_SUITE_GCMP_256) @@ -72,7 +72,7 @@ static int rsn_selector_to_bitfield(const u8 *s) #ifdef CONFIG_IEEE80211W if (RSN_SELECTOR_GET(s) == RSN_CIPHER_SUITE_AES_128_CMAC) return WPA_CIPHER_AES_128_CMAC; -#ifdef COFIG_GMAC +#ifdef CONFIG_GMAC if (RSN_SELECTOR_GET(s) == RSN_CIPHER_SUITE_BIP_GMAC_128) return WPA_CIPHER_BIP_GMAC_128; if (RSN_SELECTOR_GET(s) == RSN_CIPHER_SUITE_BIP_GMAC_256) From d23c21bd2a2a16218d907aa52f25c0b1b841a7ad Mon Sep 17 00:00:00 2001 From: jgujarathi Date: Wed, 1 Feb 2023 12:43:31 +0530 Subject: [PATCH 2/3] wpa_supplicant : Fix invalid de-init of last_scan_res_used During the wifi deinit last_scan_res_used pointer is not set to 0 which will cause it be used directly after reinit. Added changes which will set it to 0 during init and deinit. --- components/wpa_supplicant/esp_supplicant/src/esp_scan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_scan.c b/components/wpa_supplicant/esp_supplicant/src/esp_scan.c index 7a3a0d6f24..38537d58cd 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_scan.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_scan.c @@ -90,6 +90,7 @@ void esp_scan_init(struct wpa_supplicant *wpa_s) wpa_s->scanning = 0; wpa_bss_init(wpa_s); wpa_s->last_scan_res = NULL; + wpa_s->last_scan_res_used = 0; } void esp_scan_deinit(struct wpa_supplicant *wpa_s) @@ -97,6 +98,7 @@ void esp_scan_deinit(struct wpa_supplicant *wpa_s) wpa_bss_deinit(wpa_s); os_free(wpa_s->last_scan_res); wpa_s->last_scan_res = NULL; + wpa_s->last_scan_res_used = 0; } int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender, From 922cbc0cb41a84ebb07d86ba30e0b483b552e0be Mon Sep 17 00:00:00 2001 From: jgujarathi Date: Wed, 1 Feb 2023 12:45:23 +0530 Subject: [PATCH 3/3] wpa_supplicant : Prevent h2e config overwrite Current esp_wifi_get_config doesn't return correct value of h2e config which will cause h2e config to be overwritten in Station connected handler. Add one preventative condition to take care of this. --- components/wpa_supplicant/esp_supplicant/src/esp_common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_common.c b/components/wpa_supplicant/esp_supplicant/src/esp_common.c index 949350c0e6..d1203f1292 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_common.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_common.c @@ -160,8 +160,10 @@ static void clear_bssid_flag(struct wpa_supplicant *wpa_s) } esp_wifi_get_config(WIFI_IF_STA, config); - config->sta.bssid_set = 0; - esp_wifi_set_config(WIFI_IF_STA, config); + if (config->sta.bssid_set) { + config->sta.bssid_set = 0; + esp_wifi_set_config(WIFI_IF_STA, config); + } os_free(config); wpa_printf(MSG_DEBUG, "cleared bssid flag"); }