aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ctrl_iface.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-12-26 15:35:48 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-26 16:48:52 (GMT)
commitd81c73be18403f0c69d0c0ae4b26cf2c94807c8a (patch)
treefbc734a09b6c6f18d2fbb2e972ab751750bb0642 /wpa_supplicant/ctrl_iface.c
parenta5f40eff189d7f939f6434455ee63554ddb3c3ae (diff)
downloadhostap-d81c73be18403f0c69d0c0ae4b26cf2c94807c8a.zip
hostap-d81c73be18403f0c69d0c0ae4b26cf2c94807c8a.tar.gz
hostap-d81c73be18403f0c69d0c0ae4b26cf2c94807c8a.tar.bz2
Optional scan id for ctrl_iface SCAN requests
This allows users of wpa_supplicant control interface to figure out when their specific scan command has been started and completed. For example: CTRL-EVENT-SCAN-STARTED > scan freq=2412,2417 passive=1 use_id=1 3 CTRL-EVENT-SCAN-RESULTS CTRL-EVENT-SCAN-STARTED id=3 CTRL-EVENT-SCAN-RESULTS id=3 Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/ctrl_iface.c')
-rw-r--r--wpa_supplicant/ctrl_iface.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 8518d4b..f09c886 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -5264,6 +5264,7 @@ static void wpas_ctrl_scan(struct wpa_supplicant *wpa_s, char *params,
}
wpa_s->manual_scan_passive = 0;
+ wpa_s->manual_scan_use_id = 0;
if (params) {
if (os_strncasecmp(params, "TYPE=ONLY", 9) == 0)
@@ -5278,6 +5279,10 @@ static void wpas_ctrl_scan(struct wpa_supplicant *wpa_s, char *params,
pos = os_strstr(params, "passive=");
if (pos)
wpa_s->manual_scan_passive = !!atoi(pos + 8);
+
+ pos = os_strstr(params, "use_id=");
+ if (pos)
+ wpa_s->manual_scan_use_id = atoi(pos + 7);
} else {
os_free(wpa_s->manual_scan_freqs);
wpa_s->manual_scan_freqs = NULL;
@@ -5293,11 +5298,25 @@ static void wpas_ctrl_scan(struct wpa_supplicant *wpa_s, char *params,
wpa_s->after_wps = 0;
wpa_s->known_wps_freq = 0;
wpa_supplicant_req_scan(wpa_s, 0, 0);
+ if (wpa_s->manual_scan_use_id) {
+ wpa_s->manual_scan_id++;
+ wpa_dbg(wpa_s, MSG_DEBUG, "Assigned scan id %u",
+ wpa_s->manual_scan_id);
+ *reply_len = os_snprintf(reply, reply_size, "%u\n",
+ wpa_s->manual_scan_id);
+ }
} else if (wpa_s->sched_scanning) {
wpa_printf(MSG_DEBUG, "Stop ongoing sched_scan to allow requested full scan to proceed");
wpa_supplicant_cancel_sched_scan(wpa_s);
wpa_s->scan_req = MANUAL_SCAN_REQ;
wpa_supplicant_req_scan(wpa_s, 0, 0);
+ if (wpa_s->manual_scan_use_id) {
+ wpa_s->manual_scan_id++;
+ *reply_len = os_snprintf(reply, reply_size, "%u\n",
+ wpa_s->manual_scan_id);
+ wpa_dbg(wpa_s, MSG_DEBUG, "Assigned scan id %u",
+ wpa_s->manual_scan_id);
+ }
} else {
wpa_printf(MSG_DEBUG, "Ongoing scan action - reject new request");
*reply_len = os_snprintf(reply, reply_size, "FAIL-BUSY\n");