]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SME: MLD: Clear MLD state only after the deauthentication
authorIlan Peer <ilan.peer@intel.com>
Mon, 8 Apr 2024 13:06:59 +0000 (16:06 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 21 Apr 2024 08:55:53 +0000 (11:55 +0300)
In case of failure handling an Authentication frame from the AP MLD,
clear the MLD state only after the deauthentication is done. This allows
deauthentication process to use the AP MLD MAC address.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
wpa_supplicant/sme.c

index 0115caf8c55f7cd641966d9a59bf12be752dda69..f6860783e73158cd464d22b5641b1e18a3ae1d39 100644 (file)
@@ -479,7 +479,7 @@ static int wpas_sme_ml_auth(struct wpa_supplicant *wpa_s,
                                   data->auth.ies_len - ie_offset,
                                   &elems, 0) == ParseFailed) {
                wpa_printf(MSG_DEBUG, "MLD: Failed parsing elements");
-               goto out;
+               return -1;
        }
 
        if (!elems.basic_mle || !elems.basic_mle_len) {
@@ -488,7 +488,7 @@ static int wpas_sme_ml_auth(struct wpa_supplicant *wpa_s,
                    status_code == WLAN_STATUS_SUCCESS ||
                    status_code == WLAN_STATUS_SAE_HASH_TO_ELEMENT ||
                    status_code == WLAN_STATUS_SAE_PK)
-                       goto out;
+                       return -1;
                /* Accept missing Multi-Link element in failed authentication
                 * cases. */
                return 0;
@@ -496,21 +496,17 @@ static int wpas_sme_ml_auth(struct wpa_supplicant *wpa_s,
 
        mld_addr = get_basic_mle_mld_addr(elems.basic_mle, elems.basic_mle_len);
        if (!mld_addr)
-               goto out;
+               return -1;
 
        wpa_printf(MSG_DEBUG, "MLD: mld_address=" MACSTR, MAC2STR(mld_addr));
 
        if (!ether_addr_equal(wpa_s->ap_mld_addr, mld_addr)) {
                wpa_printf(MSG_DEBUG, "MLD: Unexpected MLD address (expected "
                           MACSTR ")", MAC2STR(wpa_s->ap_mld_addr));
-               goto out;
+               return -1;
        }
 
        return 0;
-out:
-       wpa_printf(MSG_DEBUG, "MLD: Authentication - clearing MLD state");
-       wpas_reset_mlo_info(wpa_s);
-       return -1;
 }
 
 
@@ -2158,6 +2154,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;
        }