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.
This commit is contained in:
Andrew Zaborowski 2020-10-11 00:42:20 +02:00 committed by Thomas Haller
parent a6ece1557c
commit c92ad05cee
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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)),