From: Jouni Malinen Date: Mon, 18 Aug 2014 18:04:56 +0000 (-0700) Subject: STA: Update scan results for ap_scan=1 skip-selection case also X-Git-Tag: hostap_2_3~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=068e38771e2064e83824889b55e7d47e75b3c2aa;p=thirdparty%2Fhostap.git STA: Update scan results for ap_scan=1 skip-selection case also The commit 5cd4740580350371d77618ac037deef90b48d339 has rearranged the update scan results code and hence the IEs were not getting updated properly for ap_scan=1 case. This can result in a 4-way handshake failure in the roaming case (IE mismatch in 3/4 EAPOL). Fix this by updating the scan results even if ap_scan=1 is used and network does not need to get reselected based on association information. Signed-off-by: Jithu Jance Signed-off-by: Dmitry Shmidt Signed-off-by: Jouni Malinen --- diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 0fe7a918d..1a0bc41f1 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -83,14 +83,31 @@ static struct wpa_bss * wpa_supplicant_get_new_bss( } +static void wpa_supplicant_update_current_bss(struct wpa_supplicant *wpa_s) +{ + struct wpa_bss *bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); + + if (!bss) { + wpa_supplicant_update_scan_results(wpa_s); + + /* Get the BSS from the new scan results */ + bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); + } + + if (bss) + wpa_s->current_bss = bss; +} + + static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s) { struct wpa_ssid *ssid, *old_ssid; - struct wpa_bss *bss; int res; - if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) + if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) { + wpa_supplicant_update_current_bss(wpa_s); return 0; + } wpa_dbg(wpa_s, MSG_DEBUG, "Select network based on association " "information"); @@ -136,16 +153,7 @@ static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s) old_ssid = wpa_s->current_ssid; wpa_s->current_ssid = ssid; - bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); - if (!bss) { - wpa_supplicant_update_scan_results(wpa_s); - - /* Get the BSS from the new scan results */ - bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid); - } - - if (bss) - wpa_s->current_bss = bss; + wpa_supplicant_update_current_bss(wpa_s); wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid); wpa_supplicant_initiate_eapol(wpa_s);