From 9ffebf758da03c24aad991f64804d315514a468a Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 21 Nov 2023 01:51:16 +0200 Subject: [PATCH] SME: Drop old disassoc_while_authenticating workaround This workaround from commit 6d6f4bb87f33 ("nl80211: Work around mac80211 limitation on (re)auth when authenticated") pre-dates the code that supresses the deauth or disconnect event from nl80211. Should this code be called it would not actually work at this point, as important internal state for the authentication attempt has already been lost. Simply drop the code. This might also fix issues where we could get into a bad state if a proper deauth/disconnect event happens while we are authenticating or associating. Signed-off-by: Benjamin Berg --- wpa_supplicant/events.c | 14 +------------- wpa_supplicant/sme.c | 22 ---------------------- wpa_supplicant/sme.h | 8 -------- 3 files changed, 1 insertion(+), 43 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index e9d6d0244..b1a2fc6f9 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -4151,16 +4151,10 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, int locally_generated) { const u8 *bssid; - int authenticating; - u8 prev_pending_bssid[ETH_ALEN]; struct wpa_bss *fast_reconnect = NULL; struct wpa_ssid *fast_reconnect_ssid = NULL; - struct wpa_ssid *last_ssid; struct wpa_bss *curr = NULL; - authenticating = wpa_s->wpa_state == WPA_AUTHENTICATING; - os_memcpy(prev_pending_bssid, wpa_s->pending_bssid, ETH_ALEN); - if (wpa_s->key_mgmt == WPA_KEY_MGMT_WPA_NONE) { /* * At least Host AP driver and a Prism3 card seemed to be @@ -4190,7 +4184,7 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, "pre-shared key may be incorrect"); if (wpas_p2p_4way_hs_failed(wpa_s) > 0) return; /* P2P group removed */ - wpas_auth_failed(wpa_s, "WRONG_KEY", prev_pending_bssid); + wpas_auth_failed(wpa_s, "WRONG_KEY", wpa_s->pending_bssid); wpas_notify_psk_mismatch(wpa_s); #ifdef CONFIG_DPP2 wpas_dpp_send_conn_status_result(wpa_s, @@ -4254,17 +4248,11 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, wpa_dbg(wpa_s, MSG_DEBUG, "Disconnect event - remove keys"); wpa_clear_keys(wpa_s, wpa_s->bssid); } - last_ssid = wpa_s->current_ssid; wpa_supplicant_mark_disassoc(wpa_s); if (curr) wpa_bss_remove(wpa_s, curr, "Connection to AP lost"); - if (authenticating && (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME)) { - sme_disassoc_while_authenticating(wpa_s, prev_pending_bssid); - wpa_s->current_ssid = last_ssid; - } - if (fast_reconnect && !wpas_network_disabled(wpa_s, fast_reconnect_ssid) && !disallowed_bssid(wpa_s, fast_reconnect->bssid) && diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 5faa03869..8c81824f0 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -2888,28 +2888,6 @@ void sme_state_changed(struct wpa_supplicant *wpa_s) } -void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s, - const u8 *prev_pending_bssid) -{ - /* - * mac80211-workaround to force deauth on failed auth cmd, - * requires us to remain in authenticating state to allow the - * second authentication attempt to be continued properly. - */ - wpa_dbg(wpa_s, MSG_DEBUG, "SME: Allow pending authentication " - "to proceed after disconnection event"); - wpa_supplicant_set_state(wpa_s, WPA_AUTHENTICATING); - os_memcpy(wpa_s->pending_bssid, prev_pending_bssid, ETH_ALEN); - - /* - * Re-arm authentication timer in case auth fails for whatever reason. - */ - eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL); - eloop_register_timeout(SME_AUTH_TIMEOUT, 0, sme_auth_timer, wpa_s, - NULL); -} - - void sme_clear_on_disassoc(struct wpa_supplicant *wpa_s) { wpa_s->sme.prev_bssid_set = 0; diff --git a/wpa_supplicant/sme.h b/wpa_supplicant/sme.h index c797d2e9e..50524d131 100644 --- a/wpa_supplicant/sme.h +++ b/wpa_supplicant/sme.h @@ -32,8 +32,6 @@ void sme_event_ch_switch(struct wpa_supplicant *wpa_s); void sme_sa_query_rx(struct wpa_supplicant *wpa_s, const u8 *da, const u8 *sa, const u8 *data, size_t len); void sme_state_changed(struct wpa_supplicant *wpa_s); -void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s, - const u8 *prev_pending_bssid); void sme_clear_on_disassoc(struct wpa_supplicant *wpa_s); void sme_deinit(struct wpa_supplicant *wpa_s); @@ -98,12 +96,6 @@ static inline void sme_state_changed(struct wpa_supplicant *wpa_s) { } -static inline void -sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s, - const u8 *prev_pending_bssid) -{ -} - static inline void sme_clear_on_disassoc(struct wpa_supplicant *wpa_s) { }