From 0d4d2b85dda1ea42b19361ebd9eb2fd0df4c24c1 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Sat, 21 Dec 2024 11:33:47 +0530 Subject: [PATCH] fix(esp_wifi): Address some review comments --- .../esp_supplicant/src/esp_common.c | 21 ++++++++----------- .../esp_supplicant/src/esp_common_i.h | 2 +- .../esp_supplicant/src/esp_scan.c | 1 - .../esp_supplicant/src/esp_wpa_main.c | 4 +++- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_common.c b/components/wpa_supplicant/esp_supplicant/src/esp_common.c index 2ada6d16ef..9b45ae3d74 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_common.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_common.c @@ -23,7 +23,6 @@ #include "rsn_supp/wpa_i.h" #include "rsn_supp/wpa.h" #include "esp_private/wifi.h" -#include "eloop.h" /* Utility Functions */ esp_err_t esp_supplicant_str_to_mac(const char *str, uint8_t dest[6]) @@ -36,9 +35,8 @@ esp_err_t esp_supplicant_str_to_mac(const char *str, uint8_t dest[6]) } struct wpa_supplicant g_wpa_supp; -#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) -static int mgmt_rx_action(u8 *frame, size_t len, u8 *sender, int8_t rssi, u8 channel); +#if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) #if defined(CONFIG_RRM) static void handle_rrm_frame(struct wpa_supplicant *wpa_s, u8 *sender, u8 *payload, size_t len, int8_t rssi) @@ -265,6 +263,7 @@ int esp_supplicant_common_init(struct wpa_funcs *wpa_cb) int ret = 0; #if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) +#if defined(CONFIG_RRM) wpas_rrm_reset(wpa_s); wpas_clear_beacon_rep_data(wpa_s); #endif /* defined(CONFIG_RRM) */ @@ -328,13 +327,16 @@ void supplicant_sta_conn_handler(uint8_t *bssid) /* Register for mgmt frames */ register_mgmt_frames(wpa_s); /* clear set bssid flag */ - clear_bssid_flag(wpa_s); + clear_bssid_flag_and_channel(wpa_s); #endif /* defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) */ } -void supplicant_sta_disconn_handler(void) +void supplicant_sta_disconn_handler(uint8_t reason_code) { +#if defined(CONFIG_IEEE80211R) struct wpa_sm *sm = &gWpaSm; +#endif /* defined(CONFIG_IEEE80211R) */ + #if defined(CONFIG_IEEE80211KV) || defined(CONFIG_IEEE80211R) struct wpa_supplicant *wpa_s = &g_wpa_supp; @@ -352,8 +354,8 @@ void supplicant_sta_disconn_handler(void) wpa_s->current_bss = NULL; } #if defined(CONFIG_IEEE80211R) - if (reason_code == WIFI_REASON_INVALID_PMKID || reason_code == WIFI_REASON_INVALID_MDE || reason_code == WIFI_REASON_INVALID_FTE || (sm->cur_pmksa == NULL)) { - /* clear all ft auth related IEs so that next will be open auth */ + if (!sm->cur_pmksa) { + /* clear all ft auth related IEs so that next will be open auth */ wpa_sta_clear_ft_auth_ie(); } #endif @@ -644,11 +646,6 @@ static size_t add_mdie(uint8_t *bssid, uint8_t *ie, size_t len) return mdie_len; } -<<<<<<< HEAD - -#ifdef CONFIG_IEEE80211R -======= ->>>>>>> 9cce89fea9e... fix(wpa_supplicant): Add two separate flags for RRM and WNM int wpa_sm_update_ft_ies(struct wpa_sm *sm, const u8 *md, const u8 *ies, size_t ies_len, bool auth_ie) { diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_common_i.h b/components/wpa_supplicant/esp_supplicant/src/esp_common_i.h index 3539ddcace..20f05618ef 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_common_i.h +++ b/components/wpa_supplicant/esp_supplicant/src/esp_common_i.h @@ -32,5 +32,5 @@ void esp_supplicant_unset_all_appie(void); void esp_set_scan_ie(void); void esp_set_assoc_ie(uint8_t *bssid, const u8 *ies, size_t ies_len, bool add_mdie); void supplicant_sta_conn_handler(uint8_t* bssid); -void supplicant_sta_disconn_handler(void); +void supplicant_sta_disconn_handler(uint8_t reason_code); #endif diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_scan.c b/components/wpa_supplicant/esp_supplicant/src/esp_scan.c index 4ff1a4f7e7..2e1ae8eed7 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_scan.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_scan.c @@ -22,7 +22,6 @@ #include "common/wnm_sta.h" #include "esp_scan_i.h" #include "esp_common_i.h" -#include "eloop.h" extern struct wpa_supplicant g_wpa_supp; diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c index 6a965e2d83..b0e3b401f6 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c @@ -260,6 +260,8 @@ static void wpa_sta_disconnected_cb(uint8_t reason_code) case WIFI_REASON_ASSOC_FAIL: case WIFI_REASON_CONNECTION_FAIL: case WIFI_REASON_HANDSHAKE_TIMEOUT: + case WIFI_REASON_INVALID_MDE: + case WIFI_REASON_INVALID_FTE: wpa_sta_clear_curr_pmksa(); wpa_sm_notify_disassoc(&gWpaSm); break; @@ -280,7 +282,7 @@ static void wpa_sta_disconnected_cb(uint8_t reason_code) #endif /* CONFIG_OWE_STA */ esp_wpa3_free_sae_data(); - supplicant_sta_disconn_handler(); + supplicant_sta_disconn_handler(reason_code); } #ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT