STA: Update scan results for ap_scan=1 skip-selection case also
authorJouni Malinen <j@w1.fi>
Mon, 18 Aug 2014 18:04:56 +0000 (11:04 -0700)
committerJouni Malinen <j@w1.fi>
Sat, 13 Sep 2014 14:31:58 +0000 (17:31 +0300)
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 <jithu@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/events.c

index 0fe7a91..1a0bc41 100644 (file)
@@ -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);