]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Allow p2p_cancel to be used to stop p2p_connect-join operation
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 18 Dec 2012 08:39:34 +0000 (10:39 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 18 Dec 2012 08:39:34 +0000 (10:39 +0200)
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>

wpa_supplicant/p2p_supplicant.c

index e44bb3aaf1870e525165aafc8313d9f09f3ccff1..dc4d99a549e4bfbf509e1fc00efb1d426e6fa65d 100644 (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) {