]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix AP selection to check privacy mismatch and IBSS with WPA/RSN IE
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 23 Jun 2011 12:39:00 +0000 (15:39 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 23 Jun 2011 12:39:00 +0000 (15:39 +0300)
These checks were previously skipped if the scan result included WPA
or RSN IE. However, that can result in selecting a network that does
not match local configuration in some cases.

wpa_supplicant/events.c

index e58abdc88af4a034daf04077fa1331121adb16e6..8768b17db11c0b3a4b43fa550026c8a696711026 100644 (file)
@@ -302,6 +302,9 @@ static int wpa_supplicant_match_privacy(struct wpa_scan_res *bss,
                privacy = 1;
 #endif /* IEEE8021X_EAPOL */
 
+       if (wpa_key_mgmt_wpa(ssid->key_mgmt))
+               privacy = 1;
+
        if (bss->caps & IEEE80211_CAP_PRIVACY)
                return privacy;
        return !privacy;
@@ -571,13 +574,13 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
                        continue;
                }
 
-               if (!wpa && !wpa_supplicant_match_privacy(bss, ssid)) {
+               if (!wpa_supplicant_match_privacy(bss, ssid)) {
                        wpa_dbg(wpa_s, MSG_DEBUG, "   skip - privacy "
                                "mismatch");
                        continue;
                }
 
-               if (!wpa && (bss->caps & IEEE80211_CAP_IBSS)) {
+               if (bss->caps & IEEE80211_CAP_IBSS) {
                        wpa_dbg(wpa_s, MSG_DEBUG, "   skip - IBSS (adhoc) "
                                "network");
                        continue;