]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Defer chirp scan if other scan is queued up
authorMichal Kazior <michal@plume.com>
Fri, 12 Feb 2021 13:27:53 +0000 (13:27 +0000)
committerJouni Malinen <j@w1.fi>
Sat, 13 Feb 2021 21:12:07 +0000 (23:12 +0200)
The chirp scan could override the scan_res_handler. This could lead to
wpa_supplicant getting stuck in a scanning state while not scanning at
all until forced to, e.g., via an explicit SCAN control command.

The condition for trigerring this problem in my testing was when
(interface_count % 3) == 2. This introduced a two second delay before
actual scan was triggered after starting the wpa_supplicant instance up.
If DPP chirping was requested fast enough, in between the queueing and
triggering, it would punt the scan request, never to be resumed again.
Chirp scan handler wouldn't resume it leaving wpa_supplicant
inadvertently idle.

Signed-off-by: Michal Kazior <michal@plume.com>
wpa_supplicant/dpp_supplicant.c

index 6a08ff8666bc71c9fb3c628aa1b8e2110702ad57..b2443ae37de19869d0a359c28d9c6320fa74e45d 100644 (file)
@@ -3628,6 +3628,17 @@ static void wpas_dpp_chirp_next(void *eloop_ctx, void *timeout_ctx)
        if (wpa_s->dpp_chirp_freq == 0) {
                if (wpa_s->dpp_chirp_round % 4 == 0 &&
                    !wpa_s->dpp_chirp_scan_done) {
+                       if (wpas_scan_scheduled(wpa_s)) {
+                               wpa_printf(MSG_DEBUG,
+                                          "DPP: Deferring chirp scan because another scan is planned already");
+                               if (eloop_register_timeout(1, 0,
+                                                          wpas_dpp_chirp_next,
+                                                          wpa_s, NULL) < 0) {
+                                       wpas_dpp_chirp_stop(wpa_s);
+                                       return;
+                               }
+                               return;
+                       }
                        wpa_printf(MSG_DEBUG,
                                   "DPP: Update channel list for chirping");
                        wpa_s->scan_req = MANUAL_SCAN_REQ;