From c92ad05cee6ed8f1edb17d0cc4a6dd2c7d8a2f46 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Sun, 11 Oct 2020 00:42:20 +0200 Subject: [PATCH] iwd: Avoid ConnectHiddenNetwork() if network is visible If the target hidden network is already recorded by IWD with its SSID during a previous active scan, use the Network.Connect() API instead of Station.ConnectHiddenNetwork() which would fail in IWD version up to 1.9. This is a rare corner case scenario though. Also drop the !nm_wifi_ap_get_supplicant_path(ap) check, I'm not sure when if ever that condition can be true, more so now that we're checking nm_wifi_ap_get_fake(ap) before that. --- src/devices/wifi/nm-device-iwd.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index 89cfb2cd28..15c1191701 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -1862,10 +1862,17 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) priv->secrets_failed = FALSE; - if (!is_connection_known_network(connection) - && nm_setting_wireless_get_hidden(s_wireless)) { + if (nm_wifi_ap_get_fake(ap)) { gs_free char *ssid_str = NULL; + if (!nm_setting_wireless_get_hidden(s_wireless)) { + _LOGW(LOGD_DEVICE | LOGD_WIFI, + "Activation: (wifi) target network not known to IWD but is not " + "marked hidden"); + NM_SET_OUT(out_failure_reason, NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED); + goto out_fail; + } + /* Use Station.ConnectHiddenNetwork method instead of Network proxy. */ ssid_str = _nm_utils_ssid_to_utf8(nm_setting_wireless_get_ssid(s_wireless)); g_dbus_proxy_call(priv->dbus_station_proxy, @@ -1879,14 +1886,6 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) return NM_ACT_STAGE_RETURN_POSTPONE; } - if (!nm_wifi_ap_get_supplicant_path(ap)) { - _LOGW(LOGD_DEVICE | LOGD_WIFI, - "Activation: (wifi) network is provisioned but dbus supplicant path for AP " - "unknown"); - NM_SET_OUT(out_failure_reason, NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED); - goto out_fail; - } - network_proxy = nm_iwd_manager_get_dbus_interface( nm_iwd_manager_get(), nm_ref_string_get_str(nm_wifi_ap_get_supplicant_path(ap)),