diff mbox series

[5/7] SME: MLD: Use AP MLD address with deauthenticate

Message ID 20240408130701.531194-5-andrei.otcheretianski@intel.com
State Accepted
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>

When the authentication is an MLD authentication need to use the AP MLD
address when requesting the driver to deauthenticate.

In addition, in case of failure handling an authentication frame from
the AP MLD, clear the MLD state only after the deauthentication is
done.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 wpa_supplicant/sme.c            |  5 +++--
 wpa_supplicant/wpa_supplicant.c | 13 ++++++++++---
 2 files changed, 13 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 775fe9ea03..5766cdbf4e 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -508,8 +508,6 @@  static int wpas_sme_ml_auth(struct wpa_supplicant *wpa_s,
 
 	return 0;
 out:
-	wpa_printf(MSG_DEBUG, "MLD: Authentication - clearing MLD state");
-	wpas_reset_mlo_info(wpa_s);
 	return -1;
 }
 
@@ -2158,6 +2156,9 @@  void sme_event_auth(struct wpa_supplicant *wpa_s, union wpa_event_data *data)
 		wpas_connection_failed(wpa_s, wpa_s->pending_bssid, NULL);
 		wpa_supplicant_deauthenticate(wpa_s,
 					      WLAN_REASON_DEAUTH_LEAVING);
+		wpa_printf(MSG_DEBUG,
+			   "MLD: Authentication - clearing MLD state");
+		wpas_reset_mlo_info(wpa_s);
 		return;
 	}
 
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index ab71e2f273..54501b7636 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -4588,9 +4588,16 @@  void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
 		reason_code, reason2str(reason_code),
 		wpa_supplicant_state_txt(wpa_s->wpa_state));
 
-	if (!is_zero_ether_addr(wpa_s->pending_bssid) &&
-	    (wpa_s->wpa_state == WPA_AUTHENTICATING ||
-	     wpa_s->wpa_state == WPA_ASSOCIATING))
+	wpa_dbg(wpa_s, MSG_DEBUG,
+		"deauthenticate: valid_links=0x%x, ap_mld_addr=" MACSTR,
+		wpa_s->valid_links, MAC2STR(wpa_s->ap_mld_addr));
+
+	if (wpa_s->valid_links &&
+	    !is_zero_ether_addr(wpa_s->ap_mld_addr))
+		addr = wpa_s->ap_mld_addr;
+	else if (!is_zero_ether_addr(wpa_s->pending_bssid) &&
+		 (wpa_s->wpa_state == WPA_AUTHENTICATING ||
+		  wpa_s->wpa_state == WPA_ASSOCIATING))
 		addr = wpa_s->pending_bssid;
 	else if (!is_zero_ether_addr(wpa_s->bssid))
 		addr = wpa_s->bssid;