From c026337792323784addd71089a8ee2368a73d3a5 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 4 Feb 2021 16:06:02 -0800 Subject: [PATCH] station: move scan cancelation to __station_connect_network An earlier patch fixed a problem where a queued quick scan would be triggered and fail once already connected, resulting in a state transition from connected --> autoconnect_full. This fixed the Connect() path but this could also happen via autoconnect. Starting from a connected state, the sequence goes: - DBus scan is triggered - AP disconnects IWD - State transition from disconnected --> autoconnect_quick - Queue quick scan - DBus scan results come in and used to autoconnect - A connect work item is inserted ahead of all others, transition from autoconnect_quick --> connecting. - Connect completes, transition from connecting --> connected - Quick scan can finally get triggered, which the kernel fails to do since IWD is connected, transition from connected --> autoconnect_full. This can be fixed by checking for a pending quick scan in the autoconnect path. --- src/station.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/station.c b/src/station.c index 8c1e97d6..6496be10 100644 --- a/src/station.c +++ b/src/station.c @@ -196,6 +196,13 @@ static void station_autoconnect_next(struct station *station) if (!r) { station_enter_state(station, STATION_STATE_CONNECTING); + + if (station->quick_scan_id) { + scan_cancel(netdev_get_wdev_id(station->netdev), + station->quick_scan_id); + station->quick_scan_id = 0; + } + return; } }