From 2efc6720752dc6ed02e15885cdc28174ac85086f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 12 Sep 2017 16:42:01 +0300 Subject: [PATCH] Fix RSN pre-authentication regression with pre-connection scan results The introduction of radio works and a delayed callback to complete association/connection requests ended up breaking RSN pre-authentication candidate list generation for the case of pre-connection scan results. Previously, wpa_supplicant_associate() set the RSN state machine configuration before returning and the calls to wpa_supplicant_rsn_preauth_scan_results() immediately after this function call were working fine. However, with the radio work callback, the RSN state machine configuration started to happen only in that callback which would be called soon after this code path has completed. This resulted in the RSN state machine not knowing the selected SSID and as such, rejecting all pre-authentication candidates. Fix this by setting the RSN state machine configuration from wpa_supplicant_associate() so that the existing callers of wpa_supplicant_rsn_preauth_scan_results() can be used as-is to add candidates for pre-authentication. Signed-off-by: Jouni Malinen --- wpa_supplicant/wpa_supplicant.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 00ef3a4b5..b8c1da44e 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1857,6 +1857,15 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, return; } + /* + * Set WPA state machine configuration to match the selected network now + * so that the information is available before wpas_start_assoc_cb() + * gets called. This is needed at least for RSN pre-authentication where + * candidate APs are added to a list based on scan result processing + * before completion of the first association. + */ + wpa_supplicant_rsn_supp_set_config(wpa_s, ssid); + #ifdef CONFIG_DPP if (wpas_dpp_check_connect(wpa_s, ssid, bss) != 0) return;