P2P: Abort ongoing scan when p2p_find is stopped

When p2p_find is stopped, send request to the driver
in order to cancel an ongoing scan if there is one.

Signed-off-by: Ben Rosenfeld <ben.rosenfeld@intel.com>
This commit is contained in:
Ben Rosenfeld 2016-02-29 14:30:04 +02:00 committed by Jouni Malinen
parent 7441698fcf
commit a805731086
2 changed files with 11 additions and 1 deletions

View file

@ -2389,6 +2389,10 @@ static void wpas_dev_lost(void *ctx, const u8 *dev_addr)
static void wpas_find_stopped(void *ctx) static void wpas_find_stopped(void *ctx)
{ {
struct wpa_supplicant *wpa_s = ctx; struct wpa_supplicant *wpa_s = ctx;
if (wpa_s->p2p_scan_work && wpas_abort_ongoing_scan(wpa_s) < 0)
wpa_printf(MSG_DEBUG, "P2P: Abort ongoing scan failed");
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_FIND_STOPPED); wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_FIND_STOPPED);
wpas_notify_p2p_find_stopped(wpa_s); wpas_notify_p2p_find_stopped(wpa_s);
} }

View file

@ -2544,7 +2544,13 @@ int wpas_mac_addr_rand_scan_set(struct wpa_supplicant *wpa_s,
int wpas_abort_ongoing_scan(struct wpa_supplicant *wpa_s) int wpas_abort_ongoing_scan(struct wpa_supplicant *wpa_s)
{ {
if (wpa_s->scan_work && wpa_s->own_scan_running) { int scan_work = !!wpa_s->scan_work;
#ifdef CONFIG_P2P
scan_work |= !!wpa_s->p2p_scan_work;
#endif /* CONFIG_P2P */
if (scan_work && wpa_s->own_scan_running) {
wpa_dbg(wpa_s, MSG_DEBUG, "Abort an ongoing scan"); wpa_dbg(wpa_s, MSG_DEBUG, "Abort an ongoing scan");
return wpa_drv_abort_scan(wpa_s); return wpa_drv_abort_scan(wpa_s);
} }