]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Update AP RSNE/RSNXE to RSN state machine on driver-selected BSS cases
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 25 Apr 2023 10:30:08 +0000 (13:30 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 25 Apr 2023 10:30:08 +0000 (13:30 +0300)
The driver-initiated BSS selection case and the "Network configuration
found for the current AP" case ended up clearing the RSN state machine
information on AP RSNE/RSNXE. That could result in incorrect behavior if
some key management operations depended on accurate information. For
example, this could result in not deriving the KDK as part of the PTK
derivation and failing to complete 4-way handshake if both the AP and
the STA indicated support for Secure LTF.

If the scan results for the selected BSS are available, use those to
update the RSN state machine AP RSNE/RSNXE similarly to the way this is
done with wpa_supplicant selects the BSS instead of clearing that
information in the RSN state machine.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wpa_supplicant/events.c

index 2eb2b9e31922ad488a463e9750d914bfd1a782dc..a05dd26a2861cc7bede969467838840180505eb9 100644 (file)
@@ -190,6 +190,7 @@ static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s,
                                        union wpa_event_data *data)
 {
        struct wpa_ssid *ssid, *old_ssid;
+       struct wpa_bss *bss;
        u8 drv_ssid[SSID_MAX_LEN];
        size_t drv_ssid_len;
        int res;
@@ -265,6 +266,7 @@ static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s,
 
        wpa_dbg(wpa_s, MSG_DEBUG, "Network configuration found for the "
                "current AP");
+       bss = wpa_supplicant_update_current_bss(wpa_s, wpa_s->bssid);
        if (wpa_key_mgmt_wpa_any(ssid->key_mgmt)) {
                u8 wpa_ie[80];
                size_t wpa_ie_len = sizeof(wpa_ie);
@@ -274,7 +276,7 @@ static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s,
                 * driver indicated the actual values used in the
                 * (Re)Association Request frame. */
                skip_default_rsne = data && data->assoc_info.req_ies;
-               if (wpa_supplicant_set_suites(wpa_s, NULL, ssid,
+               if (wpa_supplicant_set_suites(wpa_s, bss, ssid,
                                              wpa_ie, &wpa_ie_len,
                                              skip_default_rsne) < 0)
                        wpa_dbg(wpa_s, MSG_DEBUG, "Could not set WPA suites");
@@ -287,8 +289,6 @@ static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s,
        old_ssid = wpa_s->current_ssid;
        wpa_s->current_ssid = ssid;
 
-       wpa_supplicant_update_current_bss(wpa_s, wpa_s->bssid);
-
        wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
        wpa_supplicant_initiate_eapol(wpa_s);
        if (old_ssid != wpa_s->current_ssid)