P2P: Allow p2p_cancel to be used to stop p2p_connect-join operation

p2p_cancel did not properly cancel a pending p2p_connect-join operation.
Address the different steps in that process: initial scan, Provision
Discovery exchange before connection, and WPS provisioning step
(including the scans before WPS).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2012-12-18 10:39:34 +02:00 committed by Jouni Malinen
parent 03c961e542
commit 50178335bf

View file

@ -3479,6 +3479,7 @@ static int wpas_p2p_join_start(struct wpa_supplicant *wpa_s)
}
group->p2p_in_provisioning = 1;
wpa_s->global->p2p_group_formation = wpa_s;
group->p2p_fallback_to_go_neg = wpa_s->p2p_fallback_to_go_neg;
os_memset(&res, 0, sizeof(res));
@ -5190,6 +5191,13 @@ void wpas_p2p_update_channel_list(struct wpa_supplicant *wpa_s)
}
static void wpas_p2p_scan_res_ignore(struct wpa_supplicant *wpa_s,
struct wpa_scan_results *scan_res)
{
wpa_printf(MSG_DEBUG, "P2P: Ignore scan results");
}
int wpas_p2p_cancel(struct wpa_supplicant *wpa_s)
{
struct wpa_global *global = wpa_s->global;
@ -5213,6 +5221,18 @@ int wpas_p2p_cancel(struct wpa_supplicant *wpa_s)
found = 1;
}
if (wpa_s->scan_res_handler == wpas_p2p_scan_res_join) {
wpa_printf(MSG_DEBUG, "P2P: Stop pending scan for join");
wpa_s->scan_res_handler = wpas_p2p_scan_res_ignore;
found = 1;
}
if (wpa_s->pending_pd_before_join) {
wpa_printf(MSG_DEBUG, "P2P: Stop pending PD before join");
wpa_s->pending_pd_before_join = 0;
found = 1;
}
wpas_p2p_stop_find(wpa_s);
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {