]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Clear SSID selection if more than one BSSID match is found
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 28 Dec 2009 14:07:15 +0000 (16:07 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 28 Dec 2009 14:07:15 +0000 (16:07 +0200)
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.

wpa_supplicant/wps_supplicant.c

index f931de45e1bfd0c12aac88ea7f13a3d9505a51ab..f34b549efde0462b586df6fd03fe5284d228f975 100644 (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;
                }
        }