]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Postpone P2P scan only if station mode scan is pending
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 18 Mar 2013 15:11:15 +0000 (17:11 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 18 Mar 2013 15:32:31 +0000 (17:32 +0200)
sta_scan_pending was supposed to be accurate enough for determining
whether a P2P scan needs to be postponed. However, it has turned out
that there were cases where sta_scan_pending was not cleared properly.
While the known cases have now been addressed, it is possible that some
other cases may still exist. To avoid issues with P2P operationg getting
stuck, verify more carefully that there is a real pending station mode
scan (either in progress or scheduled to be requested).

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

wpa_supplicant/p2p_supplicant.c
wpa_supplicant/scan.c
wpa_supplicant/scan.h

index 76ddf0f25eb5b8c94d8797b0877a2e3a89a23c56..94a8219aa17dc6fe649c4a98fa3b157e12ebb092 100644 (file)
@@ -151,6 +151,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
 
        for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) {
                if (ifs->sta_scan_pending &&
+                   (wpas_scan_scheduled(ifs) || ifs->scanning) &&
                    wpas_p2p_in_progress(wpa_s) == 2) {
                        wpa_printf(MSG_DEBUG, "Delaying P2P scan to allow "
                                   "pending station mode scan to be "
index 29a430c978bb197da86bc1e95a85ed6bc334d8b9..1a4f6955d0f8fd4f3ea2fc150aadfd984f7db811 100644 (file)
@@ -1613,3 +1613,9 @@ void scan_only_handler(struct wpa_supplicant *wpa_s,
        wpas_notify_scan_results(wpa_s);
        wpas_notify_scan_done(wpa_s, 1);
 }
+
+
+int wpas_scan_scheduled(struct wpa_supplicant *wpa_s)
+{
+       return eloop_is_timeout_registered(wpa_supplicant_scan, wpa_s, NULL);
+}
index 5ecfa00cfd9d82d24eaaa6b66a995ab7ac90dcc6..e892479f6422e0838b1bb1f879efae49dbe8eb79 100644 (file)
@@ -35,5 +35,6 @@ int wpa_supplicant_filter_bssid_match(struct wpa_supplicant *wpa_s,
 void wpa_supplicant_update_scan_int(struct wpa_supplicant *wpa_s, int sec);
 void scan_only_handler(struct wpa_supplicant *wpa_s,
                       struct wpa_scan_results *scan_res);
+int wpas_scan_scheduled(struct wpa_supplicant *wpa_s);
 
 #endif /* SCAN_H */