P2P: Re-start P2P operation if station mode scanning is stopped
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 18 Mar 2013 15:04:23 +0000 (17:04 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 18 Mar 2013 15:32:31 +0000 (17:32 +0200)
There were couple of code paths that could end up stopping station mode
scanning without clearing sta_scan_pending. This could result in P2P
search getting stuck waiting for completion of station mode scan which
would never show up. Fix this by calling wpas_p2p_continue_after_scan()
in cases where station mode scans are stopped. This allows
sta_scan_pending to be cleared and P2P search operation continued.

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

wpa_supplicant/scan.c

index ce33d0c..29a430c 100644 (file)
@@ -531,12 +531,14 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 
        if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
                wpa_dbg(wpa_s, MSG_DEBUG, "Skip scan - interface disabled");
+               wpas_p2p_continue_after_scan(wpa_s);
                return;
        }
 
        if (wpa_s->disconnected && wpa_s->scan_req == NORMAL_SCAN_REQ) {
                wpa_dbg(wpa_s, MSG_DEBUG, "Disconnected - do not scan");
                wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+               wpas_p2p_continue_after_scan(wpa_s);
                return;
        }
 
@@ -544,9 +546,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
            wpa_s->scan_req == NORMAL_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 */
+               wpas_p2p_continue_after_scan(wpa_s);
                return;
        }
 
@@ -1143,6 +1143,7 @@ void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s)
 {
        wpa_dbg(wpa_s, MSG_DEBUG, "Cancelling scan request");
        eloop_cancel_timeout(wpa_supplicant_scan, wpa_s, NULL);
+       wpas_p2p_continue_after_scan(wpa_s);
 }