diff mbox series

[4/7] SME: Explicitly deauthenticate on authentication/association timeout

Message ID 20240408130701.531194-4-andrei.otcheretianski@intel.com
State New
Headers show
Series [1/7] tests: Wait after removing a BSS | expand

Commit Message

Andrei Otcheretianski April 8, 2024, 1:06 p.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

This would clear the local driver state and also the AP state, and
would allow clean connection establishment next time.

This is needed in cases where the AP sends the association response
frame and sets the station state to associated, but the underlying
driver, e.g., mac80211, fails to parse the association response and
drops it, eventually clearing the association flow and sending a
timeout event to user space.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 wpa_supplicant/sme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jouni Malinen April 21, 2024, 9:01 a.m. UTC | #1
On Mon, Apr 08, 2024 at 04:06:58PM +0300, Andrei Otcheretianski wrote:
> This would clear the local driver state and also the AP state, and
> would allow clean connection establishment next time.
> 
> This is needed in cases where the AP sends the association response
> frame and sets the station state to associated, but the underlying
> driver, e.g., mac80211, fails to parse the association response and
> drops it, eventually clearing the association flow and sending a
> timeout event to user space.

This seems to break the hwsim test case
eht_mld_sae_two_links_disable_enable in my test setup. The RECONNECT
command after having restarted the AP MLD seems to result in the
Authentication frames not being received (no ACK) by the AP MLD. Those
frames seem to be being sent to the old link addressed of the AP MLD and
not the ones that were assigned when restarting it.

I'm not completely sure what is causing the issue and why exactly this
change triggers this. In any case, I cannot apply this as-is without
getting whatever else might be behind this addressed.
Peer, Ilan April 30, 2024, 1:08 p.m. UTC | #2
Hi,

> -----Original Message-----
> From: Jouni Malinen <j@w1.fi>
> Sent: Sunday, 21 April 2024 12:02
> To: Otcheretianski, Andrei <andrei.otcheretianski@intel.com>
> Cc: hostap@lists.infradead.org; Peer, Ilan <ilan.peer@intel.com>
> Subject: Re: [PATCH 4/7] SME: Explicitly deauthenticate on
> authentication/association timeout
> 
> On Mon, Apr 08, 2024 at 04:06:58PM +0300, Andrei Otcheretianski wrote:
> > This would clear the local driver state and also the AP state, and
> > would allow clean connection establishment next time.
> >
> > This is needed in cases where the AP sends the association response
> > frame and sets the station state to associated, but the underlying
> > driver, e.g., mac80211, fails to parse the association response and
> > drops it, eventually clearing the association flow and sending a
> > timeout event to user space.
> 
> This seems to break the hwsim test case
> eht_mld_sae_two_links_disable_enable in my test setup. The RECONNECT
> command after having restarted the AP MLD seems to result in the Authentication
> frames not being received (no ACK) by the AP MLD. Those frames seem to be
> being sent to the old link addressed of the AP MLD and not the ones that were
> assigned when restarting it.
> 

Since the BSS table is not flushed in the wpa_supplicant, the BSS entries for the
initial AP MLD are still valid and thus the wpa_supplicant tries to use them for the
connection establishment. Flushing the BSS table before RECONNECT seems to
solve the issue.

This issue is there also before this change, however, with this change since the DEAUTH
event is injected to the wpa_supplicant, the network gets temporarily disabled and thus
the connection fails.

Sorry for the late response.

Regards,

Ilan.
diff mbox series

Patch

diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 0115caf8c5..775fe9ea03 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -2887,7 +2887,7 @@  void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s,
 {
 	wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication timed out");
 	wpas_connection_failed(wpa_s, wpa_s->pending_bssid, NULL);
-	wpa_supplicant_mark_disassoc(wpa_s);
+	wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
 }
 
 
@@ -2896,7 +2896,7 @@  void sme_event_assoc_timed_out(struct wpa_supplicant *wpa_s,
 {
 	wpa_dbg(wpa_s, MSG_DEBUG, "SME: Association timed out");
 	wpas_connection_failed(wpa_s, wpa_s->pending_bssid, NULL);
-	wpa_supplicant_mark_disassoc(wpa_s);
+	wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
 }