Browse Source

Fix AP selection to check privacy mismatch and IBSS with WPA/RSN IE

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.
Jouni Malinen 14 years ago
parent
commit
29fbc52251
1 changed files with 5 additions and 2 deletions
  1. 5 2
      wpa_supplicant/events.c

+ 5 - 2
wpa_supplicant/events.c

@@ -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;