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.
This commit is contained in:
Jouni Malinen 2009-12-28 16:07:15 +02:00 committed by Jouni Malinen
parent 2e8542756c
commit f7e5436502

View file

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