]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix pending-sta-scan processing for concurrent operation cases
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 24 Sep 2012 10:46:27 +0000 (13:46 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 24 Sep 2012 10:46:27 +0000 (13:46 +0300)
If two P2P_FIND commands and a station mode SCAN command are issued in a
sequence with the second P2P_FIND and SCAN commands started before the
initial scan from the first P2P_FIND command has completed,
sta_scan_pending may be left set without an automatic way of getting it
cleared. This can get P2P search stuck if no further station mode scan
operations are run.

Fix this by clearing the sta_scan_pending flag whenever station mode scans
are stopped due to no enabled networks resulting in INACTIVE mode getting
entered. In addition, avoid setting sta_scan_pending flag when a special
scan_res_handler is set so that this does not get enabled on the P2P
Device interface during a P2P search operation.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/events.c
wpa_supplicant/scan.c

index e245d4acd2565dc9965a168d62a7b1d7eaff1190..d696ad1f8b0605b1fadd5062a232fbc73dfff2bf 100644 (file)
@@ -854,6 +854,9 @@ static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,
                wpa_dbg(wpa_s, MSG_DEBUG, "Short-circuit new scan request "
                        "since there are no enabled networks");
                wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
+#ifdef CONFIG_P2P
+               wpa_s->sta_scan_pending = 0;
+#endif /* CONFIG_P2P */
                return;
        }
        wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec);
@@ -1053,7 +1056,8 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 #ifdef CONFIG_P2P
        if (wpa_s->global->p2p_cb_on_scan_complete &&
            !wpa_s->global->p2p_disabled &&
-           wpa_s->global->p2p != NULL && !wpa_s->sta_scan_pending) {
+           wpa_s->global->p2p != NULL && !wpa_s->sta_scan_pending &&
+           !wpa_s->scan_res_handler) {
                wpa_s->global->p2p_cb_on_scan_complete = 0;
                if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) {
                        wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation "
index f32354bd73c883868ab4d0c782d9c6af20a617f9..ea84615cf09a9cb678422dc8dccfede6f2cf0577 100644 (file)
@@ -460,6 +460,9 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
            !wpa_s->scan_req) {
                wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan");
                wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
+#ifdef CONFIG_P2P
+               wpa_s->sta_scan_pending = 0;
+#endif /* CONFIG_P2P */
                return;
        }