From: Jouni Malinen Date: Mon, 28 Dec 2009 14:07:15 +0000 (+0200) Subject: WPS: Clear SSID selection if more than one BSSID match is found X-Git-Tag: hostap_0_7_1~151 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f7e54365022cd30de16e32d4a88e085861243881;p=thirdparty%2Fhostap.git WPS: Clear SSID selection if more than one BSSID match is found Need to use wildcard SSID matching for WPS connection if the same BSSID occurs multiple time in scan results since any of the SSIDs may be used. --- diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index f931de45e..f34b549ef 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -32,6 +32,7 @@ #include "blacklist.h" #include "wps_supplicant.h" + #define WPS_PIN_SCAN_IGNORE_SEL_REG 3 static void wpas_wps_timeout(void *eloop_ctx, void *timeout_ctx); @@ -588,7 +589,7 @@ static struct wpa_ssid * wpas_wps_add_network(struct wpa_supplicant *wpa_s, if (bssid) { size_t i; - struct wpa_scan_res *res; + int count = 0; os_memcpy(ssid->bssid, bssid, ETH_ALEN); ssid->bssid_set = 1; @@ -600,6 +601,7 @@ static struct wpa_ssid * wpas_wps_add_network(struct wpa_supplicant *wpa_s, for (i = 0; i < wpa_s->scan_res->num; i++) { const u8 *ie; + struct wpa_scan_res *res; res = wpa_s->scan_res->res[i]; if (os_memcmp(bssid, res->bssid, ETH_ALEN) != 0) @@ -614,7 +616,18 @@ static struct wpa_ssid * wpas_wps_add_network(struct wpa_supplicant *wpa_s, break; os_memcpy(ssid->ssid, ie + 2, ie[1]); ssid->ssid_len = ie[1]; - break; + wpa_hexdump_ascii(MSG_DEBUG, "WPS: Picked SSID from " + "scan results", + ssid->ssid, ssid->ssid_len); + count++; + } + + if (count > 1) { + wpa_printf(MSG_DEBUG, "WPS: More than one SSID found " + "for the AP; use wildcard"); + os_free(ssid->ssid); + ssid->ssid = NULL; + ssid->ssid_len = 0; } }