diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 7c98f5344..03d0e1fde 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -650,10 +650,14 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s) wpas_notify_scan_done(wpa_s, 1); - if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s)) || - wpa_s->disconnected) + if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s))) return; + if (wpa_s->disconnected) { + wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); + return; + } + while (selected == NULL) { for (prio = 0; prio < wpa_s->conf->num_prio; prio++) { selected = wpa_supplicant_select_bss( diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 10eb525bb..e122e670d 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -191,8 +191,10 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) struct wpa_driver_scan_params params; size_t max_ssids; - if (wpa_s->disconnected && !wpa_s->scan_req) + if (wpa_s->disconnected && !wpa_s->scan_req) { + wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); return; + } if (!wpa_supplicant_enabled_networks(wpa_s->conf) && !wpa_s->scan_req) {