From: Jouni Malinen Date: Thu, 23 Jun 2011 12:39:00 +0000 (+0300) Subject: Fix AP selection to check privacy mismatch and IBSS with WPA/RSN IE X-Git-Tag: hostap-1-bp~361 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=29fbc52251e37d2981033978693050c62d801138;p=thirdparty%2Fhostap.git 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. --- diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index e58abdc88..8768b17db 100644 --- a/wpa_supplicant/events.c +++ b/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;