aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-12-26 15:33:26 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-26 16:27:48 (GMT)
commita5f40eff189d7f939f6434455ee63554ddb3c3ae (patch)
tree04001f2d8c1ab273d7c85841b9551e8b2a6ca617 /wpa_supplicant
parent18ae237783736feed235497c2269f59e7bc88f0d (diff)
downloadhostap-a5f40eff189d7f939f6434455ee63554ddb3c3ae.zip
hostap-a5f40eff189d7f939f6434455ee63554ddb3c3ae.tar.gz
hostap-a5f40eff189d7f939f6434455ee63554ddb3c3ae.tar.bz2
Track whether scan was started by us or an external program
This can be used to improve scan behavior in cases external programs request scans directly from the driver. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/events.c17
-rw-r--r--wpa_supplicant/p2p_supplicant.c2
-rw-r--r--wpa_supplicant/scan.c1
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h3
4 files changed, 22 insertions, 1 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index eeb27e3..740309d 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1265,7 +1265,8 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
return 0;
}
- wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available");
+ wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available (own=%u ext=%u)",
+ wpa_s->own_scan_running, wpa_s->external_scan_running);
wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
wpas_notify_scan_results(wpa_s);
@@ -2736,8 +2737,22 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
wpa_supplicant_event_michael_mic_failure(wpa_s, data);
break;
#ifndef CONFIG_NO_SCAN_PROCESSING
+ case EVENT_SCAN_STARTED:
+ if (wpa_s->own_scan_requested) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "Own scan request started a scan");
+ wpa_s->own_scan_requested = 0;
+ wpa_s->own_scan_running = 1;
+ wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_STARTED);
+ } else {
+ wpa_dbg(wpa_s, MSG_DEBUG, "External program started a scan");
+ wpa_s->external_scan_running = 1;
+ wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_STARTED);
+ }
+ break;
case EVENT_SCAN_RESULTS:
wpa_supplicant_event_scan_results(wpa_s, data);
+ wpa_s->own_scan_running = 0;
+ wpa_s->external_scan_running = 0;
if (wpa_s->wpa_state != WPA_AUTHENTICATING &&
wpa_s->wpa_state != WPA_ASSOCIATING)
wpas_p2p_continue_after_scan(wpa_s);
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 117e493..b4b3da2 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -319,6 +319,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
} else {
os_get_reltime(&wpa_s->scan_trigger_time);
wpa_s->scan_res_handler = wpas_p2p_scan_res_handler;
+ wpa_s->own_scan_requested = 1;
}
return ret;
@@ -4031,6 +4032,7 @@ static void wpas_p2p_join_scan_req(struct wpa_supplicant *wpa_s, int freq)
if (!ret) {
os_get_reltime(&wpa_s->scan_trigger_time);
wpa_s->scan_res_handler = wpas_p2p_scan_res_join;
+ wpa_s->own_scan_requested = 1;
}
wpabuf_free(ies);
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index d963452..3fcd616 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -163,6 +163,7 @@ int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
os_get_reltime(&wpa_s->scan_trigger_time);
wpa_s->scan_runs++;
wpa_s->normal_scans++;
+ wpa_s->own_scan_requested = 1;
}
return ret;
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index ebe30e4..960008e 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -483,6 +483,9 @@ struct wpa_supplicant {
int *next_scan_freqs;
int *manual_scan_freqs;
unsigned int manual_scan_passive:1;
+ unsigned int own_scan_requested:1;
+ unsigned int own_scan_running:1;
+ unsigned int external_scan_running:1;
int scan_interval; /* time in sec between scans to find suitable AP */
int normal_scans; /* normal scans run before sched_scan */
int scan_for_connection; /* whether the scan request was triggered for