]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SME: Postpone current BSSID clearing until IEs are prepared
authorJouni Malinen <j@w1.fi>
Fri, 3 Jan 2020 16:06:01 +0000 (18:06 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 3 Jan 2020 16:06:01 +0000 (18:06 +0200)
sme_send_authentication() could fail before actually requesting the
driver to authenticate with a new AP. This could happen after
wpa_s->bssid got cleared even though in such a case, the old association
is maintained and still valid. This can result in unexpected behavior
since wpa_s->bssid would not match the current BSSID anymore.

Fix this by postponing clearing of wpa_s->bssid until the IE preparation
has been completed successfully.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/sme.c

index 08d7e3ece2d4f83f0c1f81ee38c755b46334ad82..2d7373e559e2481883792703f88827e3312b1084 100644 (file)
@@ -372,12 +372,6 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
        }
        params.wep_tx_keyidx = ssid->wep_tx_keyidx;
 
-       bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
-       os_memset(wpa_s->bssid, 0, ETH_ALEN);
-       os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);
-       if (bssid_changed)
-               wpas_notify_bssid_changed(wpa_s);
-
        if ((wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE) ||
             wpa_bss_get_ie(bss, WLAN_EID_RSN)) &&
            wpa_key_mgmt_wpa(ssid->key_mgmt)) {
@@ -718,6 +712,12 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
        }
 #endif /* CONFIG_SAE */
 
+       bssid_changed = !is_zero_ether_addr(wpa_s->bssid);
+       os_memset(wpa_s->bssid, 0, ETH_ALEN);
+       os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);
+       if (bssid_changed)
+               wpas_notify_bssid_changed(wpa_s);
+
        old_ssid = wpa_s->current_ssid;
        wpa_s->current_ssid = ssid;
        wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);