aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/scan.c
diff options
context:
space:
mode:
authorKrishna Vamsi <vamsin@qti.qualcomm.com>2015-05-21 13:59:31 (GMT)
committerJouni Malinen <j@w1.fi>2015-06-05 12:55:26 (GMT)
commita80651d06774dfd93b51d1f8b71345956724807a (patch)
treeb8330ed7e3ae7fd23b41622951e8dc2f4ff08d4d /wpa_supplicant/scan.c
parentd6f6a86a049ae290afe3e009ce971154c88a3d39 (diff)
downloadhostap-a80651d06774dfd93b51d1f8b71345956724807a.zip
hostap-a80651d06774dfd93b51d1f8b71345956724807a.tar.gz
hostap-a80651d06774dfd93b51d1f8b71345956724807a.tar.bz2
Add support to request a scan with specific SSIDs
Support a request to scan specific SSIDs given by user with the SCAN command. The SSID list can be suffixed to the scan command as follows. For example, if SSIDs "ABC" and "abc123" need to be specifically scanned, the command should be "SCAN ssid 414243 ssid 616263313233". The value of the SSID is passed in hexadecimal representation. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/scan.c')
-rw-r--r--wpa_supplicant/scan.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 3c6b2c7..e81465c 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -614,6 +614,37 @@ static void wpa_set_scan_ssids(struct wpa_supplicant *wpa_s,
}
+static int wpa_set_ssids_from_scan_req(struct wpa_supplicant *wpa_s,
+ struct wpa_driver_scan_params *params,
+ size_t max_ssids)
+{
+ unsigned int i;
+
+ if (wpa_s->ssids_from_scan_req == NULL ||
+ wpa_s->num_ssids_from_scan_req == 0)
+ return 0;
+
+ if (wpa_s->num_ssids_from_scan_req > max_ssids) {
+ wpa_s->num_ssids_from_scan_req = max_ssids;
+ wpa_printf(MSG_DEBUG, "Over max scan SSIDs from scan req: %u",
+ (unsigned int) max_ssids);
+ }
+
+ for (i = 0; i < wpa_s->num_ssids_from_scan_req; i++) {
+ params->ssids[i].ssid = wpa_s->ssids_from_scan_req[i].ssid;
+ params->ssids[i].ssid_len =
+ wpa_s->ssids_from_scan_req[i].ssid_len;
+ wpa_hexdump_ascii(MSG_DEBUG, "specific SSID",
+ params->ssids[i].ssid,
+ params->ssids[i].ssid_len);
+ }
+
+ params->num_ssids = wpa_s->num_ssids_from_scan_req;
+ wpa_s->num_ssids_from_scan_req = 0;
+ return 1;
+}
+
+
static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
{
struct wpa_supplicant *wpa_s = eloop_ctx;
@@ -726,6 +757,12 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
goto scan;
}
+ if (wpa_s->last_scan_req == MANUAL_SCAN_REQ &&
+ wpa_set_ssids_from_scan_req(wpa_s, &params, max_ssids)) {
+ wpa_printf(MSG_DEBUG, "Use specific SSIDs from SCAN command");
+ goto ssid_list_set;
+ }
+
#ifdef CONFIG_P2P
if ((wpa_s->p2p_in_provisioning || wpa_s->show_group_started) &&
wpa_s->go_params && !wpa_s->conf->passive_scan) {
@@ -891,10 +928,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
wpa_dbg(wpa_s, MSG_DEBUG, "Starting AP scan for wildcard "
"SSID");
}
-#ifdef CONFIG_P2P
-ssid_list_set:
-#endif /* CONFIG_P2P */
+ssid_list_set:
wpa_supplicant_optimize_freqs(wpa_s, &params);
extra_ie = wpa_supplicant_extra_ies(wpa_s);