Add broadcast SSID for sched_scan for scan_ssid=0 networks

Previously, only networks with scan_ssid=1 were included in sched_scan.
This needs to behave similarly to the normal scan where broadcast SSID
is used to find networks that are not scanned for with a specific SSID.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2011-11-28 18:12:38 +02:00 committed by Jouni Malinen
parent 5edddf4175
commit 76a5249e52

View file

@ -701,6 +701,7 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
struct wpabuf *wps_ie = NULL;
int ret;
unsigned int max_sched_scan_ssids;
int wildcard = 0;
if (!wpa_s->sched_scan_supported)
return -1;
@ -709,6 +710,8 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
max_sched_scan_ssids = WPAS_MAX_SCAN_SSIDS;
else
max_sched_scan_ssids = wpa_s->max_sched_scan_ssids;
if (max_sched_scan_ssids < 1)
return -1;
if (wpa_s->sched_scanning) {
wpa_dbg(wpa_s, MSG_DEBUG, "Already sched scanning");
@ -726,6 +729,14 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
wpa_s->wpa_state == WPA_INACTIVE)
wpa_supplicant_set_state(wpa_s, WPA_SCANNING);
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
if (!ssid->disabled && !ssid->scan_ssid) {
/* Use wildcard SSID to find this network */
wildcard = 1;
break;
}
}
/* Find the starting point from which to continue scanning */
ssid = wpa_s->conf->ssid;
if (wpa_s->prev_sched_ssid) {
@ -748,6 +759,11 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
wpa_s->prev_sched_ssid = ssid;
}
if (wildcard) {
wpa_dbg(wpa_s, MSG_DEBUG, "Add wildcard SSID to sched_scan");
params.num_ssids++;
}
while (ssid) {
if (ssid->disabled)
goto next;
@ -771,6 +787,8 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
}
if (ssid->scan_ssid && ssid->ssid && ssid->ssid_len) {
if (params.num_ssids == max_sched_scan_ssids)
break; /* only room for broadcast SSID */
wpa_dbg(wpa_s, MSG_DEBUG,
"add to active scan ssid: %s",
wpa_ssid_txt(ssid->ssid, ssid->ssid_len));