]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix regression in RSN pre-authentication candidate list generation
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 19 May 2011 14:52:46 +0000 (17:52 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 19 May 2011 14:52:46 +0000 (17:52 +0300)
Processing of the scan results for RSN pre-authentication candidates
was moved to happen before the network was selected. This resulted in
all candidates being dropped due to no SSID having been configured.
Fix this by moving the processing to happen after the network has
been selected. Since the raw scan results are not available at that
point, use the BSS table instead of scan results to fetch the
information.

wpa_supplicant/events.c

index 7a22d6d2111d0f1c10895d2bb209bff460dd68d1..e58abdc88af4a034daf04077fa1331121adb16e6 100644 (file)
@@ -756,28 +756,25 @@ wpa_supplicant_pick_new_network(struct wpa_supplicant *wpa_s)
 /* TODO: move the rsn_preauth_scan_result*() to be called from notify.c based
  * on BSS added and BSS changed events */
 static void wpa_supplicant_rsn_preauth_scan_results(
-       struct wpa_supplicant *wpa_s, struct wpa_scan_results *scan_res)
+       struct wpa_supplicant *wpa_s)
 {
-       int i;
+       struct wpa_bss *bss;
 
        if (rsn_preauth_scan_results(wpa_s->wpa) < 0)
                return;
 
-       for (i = scan_res->num - 1; i >= 0; i--) {
+       dl_list_for_each(bss, &wpa_s->bss, struct wpa_bss, list) {
                const u8 *ssid, *rsn;
-               struct wpa_scan_res *r;
-
-               r = scan_res->res[i];
 
-               ssid = wpa_scan_get_ie(r, WLAN_EID_SSID);
+               ssid = wpa_bss_get_ie(bss, WLAN_EID_SSID);
                if (ssid == NULL)
                        continue;
 
-               rsn = wpa_scan_get_ie(r, WLAN_EID_RSN);
+               rsn = wpa_bss_get_ie(bss, WLAN_EID_RSN);
                if (rsn == NULL)
                        continue;
 
-               rsn_preauth_scan_result(wpa_s->wpa, r->bssid, ssid, rsn);
+               rsn_preauth_scan_result(wpa_s->wpa, bss->bssid, ssid, rsn);
        }
 
 }
@@ -945,8 +942,6 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
                return 0;
        }
 
-       wpa_supplicant_rsn_preauth_scan_results(wpa_s, scan_res);
-
        selected = wpa_supplicant_pick_network(wpa_s, scan_res, &ssid);
 
        if (selected) {
@@ -957,6 +952,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
                if (skip)
                        return 0;
                wpa_supplicant_connect(wpa_s, selected, ssid);
+               wpa_supplicant_rsn_preauth_scan_results(wpa_s);
        } else {
                wpa_scan_results_free(scan_res);
                wpa_dbg(wpa_s, MSG_DEBUG, "No suitable network found");
@@ -964,6 +960,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
                if (ssid) {
                        wpa_dbg(wpa_s, MSG_DEBUG, "Setup a new network");
                        wpa_supplicant_associate(wpa_s, NULL, ssid);
+                       wpa_supplicant_rsn_preauth_scan_results(wpa_s);
                } else {
                        int timeout_sec = wpa_s->scan_interval;
                        int timeout_usec = 0;