3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 09:39:25 +01:00

station: cancel hidden network scan when connecting

Before connecting to a hidden network we must scan. During this scan
if another connection attempt comes in the expected behavior is to
abort the original connection. Rather than waiting for the scan to
complete, then canceling the original hidden connection we can just
cancel the hidden scan immediately, reply to dbus, and continue with
the new connection attempt.
This commit is contained in:
James Prestwood 2020-07-08 17:04:36 -07:00 committed by Denis Kenzior
parent 7e0084e6ae
commit a3d0eebe74

View File

@ -2488,6 +2488,19 @@ void station_connect_network(struct station *station, struct network *network,
struct l_dbus *dbus = dbus_get_bus();
int err;
/*
* If a hidden scan is not completed, station_is_busy would not
* indicate anything is going on so we need to cancel the scan and
* fail the connection now.
*/
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_failed(station->hidden_pending));
}
if (station_is_busy(station)) {
station_disconnect_onconnect(station, network, bss, message);
@ -2539,6 +2552,8 @@ static bool station_hidden_network_scan_results(int err,
msg = station->hidden_pending;
station->hidden_pending = NULL;
/* Zero this now so station_connect_network knows the scan is done */
station->hidden_network_scan_id = 0;
if (err) {
dbus_pending_reply(&msg, dbus_error_failed(msg));