From 758dba214e29d7c09d4559d36966e4dbbf8ba9ca Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Thu, 8 Oct 2020 10:49:07 +0200 Subject: [PATCH] station: Make Disconnect() cancel ConnectHiddenNetwork() ConnectHiddenNetwork can be seen a triggering this sequence: 1. the active scan, 2. the optional agent request, 3. the Authentication/Association/4-Way Handshake/netconfig, 4. connected state Currently Disconnect() interrupts 3 and 4, allow it to also interrupt state 1. It's difficult to tell whether we're in state 2 from within station.c. --- src/station.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/station.c b/src/station.c index 7fb4ae77..ad2c83a6 100644 --- a/src/station.c +++ b/src/station.c @@ -2749,6 +2749,15 @@ static struct l_dbus_message *station_dbus_disconnect(struct l_dbus *dbus, */ station_set_autoconnect(station, false); + if (station->hidden_network_scan_id) { + scan_cancel(netdev_get_wdev_id(station->netdev), + station->hidden_network_scan_id); + dbus_pending_reply(&station->hidden_pending, + dbus_error_aborted(station->hidden_pending)); + + return l_dbus_message_new_method_return(message); + } + if (!station_is_busy(station)) return l_dbus_message_new_method_return(message);