mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 12:38:10 +02:00
iwd: Better checks before setting NO_SECRETS reason
When a connection fails and IWD returns net.connman.iwd.Aborted, we know whether the abort is caused by us cancelling a secrets request so use tha knowledge to decide whether to use the NM_DEVICE_STATE_REASON_NO_SECRETS reason code for the state switch to NM_DEVICE_STATE_FAILED.
This commit is contained in:
parent
b7d3e99a28
commit
6cf475e6db
1 changed files with 10 additions and 2 deletions
|
|
@ -60,6 +60,7 @@ typedef struct {
|
|||
bool scanning : 1;
|
||||
bool scan_requested : 1;
|
||||
bool act_mode_switch : 1;
|
||||
bool secrets_failed : 1;
|
||||
gint64 last_scan;
|
||||
} NMDeviceIwdPrivate;
|
||||
|
||||
|
|
@ -1257,6 +1258,7 @@ wifi_secrets_cb(NMActRequest * req,
|
|||
priv->wifi_secrets_id = NULL;
|
||||
|
||||
if (nm_utils_error_is_cancelled(error)) {
|
||||
priv->secrets_failed = TRUE;
|
||||
g_dbus_method_invocation_return_error_literal(invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_CONNECTION,
|
||||
|
|
@ -1297,6 +1299,7 @@ wifi_secrets_cb(NMActRequest * req,
|
|||
return;
|
||||
|
||||
secrets_error:
|
||||
priv->secrets_failed = TRUE;
|
||||
g_dbus_method_invocation_return_error_literal(invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_INVALID_CONNECTION,
|
||||
|
|
@ -1375,7 +1378,7 @@ network_connect_cb(GObject *source, GAsyncResult *res, gpointer user_data)
|
|||
|
||||
/* If secrets were wrong, we'd be getting a net.connman.iwd.Failed */
|
||||
reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
|
||||
} else if (nm_streq0(dbus_error, "net.connman.iwd.Aborted")) {
|
||||
} else if (nm_streq0(dbus_error, "net.connman.iwd.Aborted") && priv->secrets_failed) {
|
||||
/* If agent call was cancelled we'd be getting a net.connman.iwd.Aborted */
|
||||
reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
|
||||
}
|
||||
|
|
@ -1812,6 +1815,8 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
goto out_fail;
|
||||
}
|
||||
|
||||
priv->secrets_failed = FALSE;
|
||||
|
||||
if (!is_connection_known_network(connection)
|
||||
&& nm_setting_wireless_get_hidden(s_wireless)) {
|
||||
gs_free char *ssid_str = NULL;
|
||||
|
|
@ -2485,6 +2490,7 @@ error:
|
|||
gboolean
|
||||
nm_device_iwd_agent_query(NMDeviceIwd *self, GDBusMethodInvocation *invocation)
|
||||
{
|
||||
NMDeviceIwdPrivate * priv = NM_DEVICE_IWD_GET_PRIVATE(self);
|
||||
NMActRequest * req;
|
||||
const char * setting_name;
|
||||
const char * setting_key;
|
||||
|
|
@ -2501,8 +2507,10 @@ nm_device_iwd_agent_query(NMDeviceIwd *self, GDBusMethodInvocation *invocation)
|
|||
invocation,
|
||||
&setting_name,
|
||||
&setting_key,
|
||||
&replied))
|
||||
&replied)) {
|
||||
priv->secrets_failed = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (replied)
|
||||
return TRUE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue