]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not consider the p2p_scan results after p2p_stop_find
authorSunil Dutt <usdutt@qti.qualcomm.com>
Thu, 30 Oct 2014 15:21:52 +0000 (20:51 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 30 Oct 2014 22:50:01 +0000 (00:50 +0200)
If p2p_stop_find is issued after the p2p_scan request is triggered to
the host driver, the obtained scan results are also considered to update
the P2P peer entries. This is not always desired behavior, i.e., it can
be clearer if no P2P-DEVICE-FOUND events are generated based of that
final pending scan.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/p2p_supplicant.c

index 42d969f9b4a545602306ccbcb3620fb713eb9195..58480a7c03e2721f00e3c1930c7288a0a78c35cf 100644 (file)
@@ -5035,6 +5035,7 @@ static void p2p_ctrl_flush(struct wpa_supplicant *wpa_s)
 {
        os_memset(wpa_s->p2p_auth_invite, 0, ETH_ALEN);
        wpa_s->force_long_sd = 0;
+       wpas_p2p_stop_find(wpa_s);
        if (wpa_s->global->p2p)
                p2p_flush(wpa_s->global->p2p);
 }
index b064ee09fcedbb40e17b12b47b73748b1fcb507b..aac3a10d4135e034fe471b9e5943f648f50b1c68 100644 (file)
@@ -5900,6 +5900,28 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout,
 }
 
 
+static void wpas_p2p_scan_res_ignore_search(struct wpa_supplicant *wpa_s,
+                                           struct wpa_scan_results *scan_res)
+{
+       wpa_printf(MSG_DEBUG, "P2P: Ignore scan results");
+
+       if (wpa_s->p2p_scan_work) {
+               struct wpa_radio_work *work = wpa_s->p2p_scan_work;
+               wpa_s->p2p_scan_work = NULL;
+               radio_work_done(work);
+       }
+
+       if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
+               return;
+
+       /*
+        * Indicate that results have been processed so that the P2P module can
+        * continue pending tasks.
+        */
+       p2p_scan_res_handled(wpa_s->global->p2p);
+}
+
+
 static void wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s)
 {
        wpas_p2p_clear_pending_action_tx(wpa_s);
@@ -5909,6 +5931,12 @@ static void wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s)
 
        if (wpa_s->global->p2p)
                p2p_stop_find(wpa_s->global->p2p);
+
+       if (wpa_s->scan_res_handler == wpas_p2p_scan_res_handler) {
+               wpa_printf(MSG_DEBUG,
+                          "P2P: Do not consider the scan results after stop_find");
+               wpa_s->scan_res_handler = wpas_p2p_scan_res_ignore_search;
+       }
 }