diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/nm-device-ethernet.c | 10 | ||||
-rw-r--r-- | src/devices/nm-device-macsec.c | 8 | ||||
-rw-r--r-- | src/devices/nm-device.c | 24 | ||||
-rw-r--r-- | src/devices/nm-device.h | 8 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 7 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 20 |
6 files changed, 37 insertions, 40 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 672ae3cd52..dd9d4c7715 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -272,7 +272,7 @@ device_state_changed (NMDevice *device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_DISCONNECTED)) { priv = NM_DEVICE_ETHERNET_GET_PRIVATE (NM_DEVICE_ETHERNET (device)); - priv->auth_retries = NM_DEVICE_802_1X_AUTH_RETRIES_UNSET; + priv->auth_retries = NM_DEVICE_AUTH_RETRIES_UNSET; } } @@ -284,7 +284,7 @@ nm_device_ethernet_init (NMDeviceEthernet *self) priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate); self->_priv = priv; - priv->auth_retries = NM_DEVICE_802_1X_AUTH_RETRIES_UNSET; + priv->auth_retries = NM_DEVICE_AUTH_RETRIES_UNSET; priv->s390_options = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free); } @@ -677,8 +677,8 @@ handle_auth_or_fail (NMDeviceEthernet *self, priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); - if (!nm_device_802_1x_auth_retries_try_next (NM_DEVICE (self), - &priv->auth_retries)) + if (!nm_device_auth_retries_try_next (NM_DEVICE (self), + &priv->auth_retries)) return NM_ACT_STAGE_RETURN_FAILURE; nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_NONE); @@ -1344,7 +1344,7 @@ deactivate (NMDevice *device) GError *error = NULL; /* Clear wired secrets tries when deactivating */ - priv->auth_retries = NM_DEVICE_802_1X_AUTH_RETRIES_UNSET; + priv->auth_retries = NM_DEVICE_AUTH_RETRIES_UNSET; nm_clear_g_source (&priv->pppoe_wait_id); diff --git a/src/devices/nm-device-macsec.c b/src/devices/nm-device-macsec.c index d8e2cc9dbb..3d95d73478 100644 --- a/src/devices/nm-device-macsec.c +++ b/src/devices/nm-device-macsec.c @@ -484,8 +484,8 @@ handle_auth_or_fail (NMDeviceMacsec *self, priv = NM_DEVICE_MACSEC_GET_PRIVATE (self); - if (!nm_device_802_1x_auth_retries_try_next (NM_DEVICE (self), - &priv->auth_retries)) + if (!nm_device_auth_retries_try_next (NM_DEVICE (self), + &priv->auth_retries)) return NM_ACT_STAGE_RETURN_FAILURE; nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_NONE); @@ -750,7 +750,7 @@ device_state_changed (NMDevice *device, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_DISCONNECTED)) { priv = NM_DEVICE_MACSEC_GET_PRIVATE (NM_DEVICE_MACSEC (device)); - priv->auth_retries = NM_DEVICE_802_1X_AUTH_RETRIES_UNSET; + priv->auth_retries = NM_DEVICE_AUTH_RETRIES_UNSET; } } @@ -812,7 +812,7 @@ nm_device_macsec_init (NMDeviceMacsec *self) { NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (self); - priv->auth_retries = NM_DEVICE_802_1X_AUTH_RETRIES_UNSET; + priv->auth_retries = NM_DEVICE_AUTH_RETRIES_UNSET; } static void diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 36cfc9c9af..4be9a3687f 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -14024,42 +14024,38 @@ nm_device_get_supplicant_timeout (NMDevice *self) } gboolean -nm_device_802_1x_auth_retries_try_next (NMDevice *self, int *p_auth_retries) +nm_device_auth_retries_try_next (NMDevice *self, int *p_auth_retries) { - NMConnection *applied_connection; - NMSetting8021x *security; + NMSettingConnection *s_con; int auth_retries = *p_auth_retries; - if (G_UNLIKELY (auth_retries == NM_DEVICE_802_1X_AUTH_RETRIES_UNSET)) { + if (G_UNLIKELY (auth_retries == NM_DEVICE_AUTH_RETRIES_UNSET)) { auth_retries = -1; - applied_connection = nm_device_get_applied_connection (NM_DEVICE (self)); - if (applied_connection) { - security = nm_connection_get_setting_802_1x (applied_connection); - if (security) - auth_retries = nm_setting_802_1x_get_auth_retries (security); - } + s_con = NM_SETTING_CONNECTION (nm_device_get_applied_setting (self, NM_TYPE_SETTING_CONNECTION)); + if (s_con) + auth_retries = nm_setting_connection_get_auth_retries (s_con); if (auth_retries == -1) { gs_free char *value = NULL; value = nm_config_data_get_connection_default (NM_CONFIG_GET_DATA, - "802-1x.auth-retries", + "connection.auth-retries", self); auth_retries = _nm_utils_ascii_str_to_int64 (value, 10, -1, G_MAXINT32, -1); } if (auth_retries == 0) - auth_retries = NM_DEVICE_802_1X_AUTH_RETRIES_INFINITY; + auth_retries = NM_DEVICE_AUTH_RETRIES_INFINITY; else if (auth_retries == -1) - auth_retries = NM_DEVICE_802_1X_AUTH_RETRIES_DEFAULT; + auth_retries = NM_DEVICE_AUTH_RETRIES_DEFAULT; else nm_assert (auth_retries > 0); *p_auth_retries = auth_retries; } - if (auth_retries == NM_DEVICE_802_1X_AUTH_RETRIES_INFINITY) + if (auth_retries == NM_DEVICE_AUTH_RETRIES_INFINITY) return TRUE; if (auth_retries <= 0) { nm_assert (auth_retries == 0); diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 6e4aa0d9e2..90f9c1fc03 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -736,11 +736,11 @@ void nm_device_update_permanent_hw_address (NMDevice *self, gboolean force_freez void nm_device_update_dynamic_ip_setup (NMDevice *self); guint nm_device_get_supplicant_timeout (NMDevice *self); -#define NM_DEVICE_802_1X_AUTH_RETRIES_UNSET -1 -#define NM_DEVICE_802_1X_AUTH_RETRIES_INFINITY -2 -#define NM_DEVICE_802_1X_AUTH_RETRIES_DEFAULT 3 +#define NM_DEVICE_AUTH_RETRIES_UNSET -1 +#define NM_DEVICE_AUTH_RETRIES_INFINITY -2 +#define NM_DEVICE_AUTH_RETRIES_DEFAULT 3 -gboolean nm_device_802_1x_auth_retries_try_next (NMDevice *self, int *p_auth_retry); +gboolean nm_device_auth_retries_try_next (NMDevice *self, int *p_auth_retry); gboolean nm_device_hw_addr_get_cloned (NMDevice *self, NMConnection *connection, diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index 7b487f0f93..4754bea5d3 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -193,6 +193,7 @@ make_connection_setting (const char *file, const char *v; gs_free char *stable_id = NULL; const char *const *iter; + int vint64; ifcfg_name = utils_get_ifcfg_name (file, TRUE); if (!ifcfg_name) @@ -329,6 +330,9 @@ make_connection_setting (const char *file, break; } + vint64 = svGetValueInt64 (ifcfg, "AUTH_RETRIES", 10, -1, G_MAXINT32, -1); + g_object_set (s_con, NM_SETTING_CONNECTION_AUTH_RETRIES, (gint) vint64, NULL); + return NM_SETTING (s_con); } @@ -3358,9 +3362,6 @@ next: timeout = svGetValueInt64 (ifcfg, "IEEE_8021X_AUTH_TIMEOUT", 10, 0, G_MAXINT32, 0); g_object_set (s_8021x, NM_SETTING_802_1X_AUTH_TIMEOUT, (gint) timeout, NULL); - timeout = svGetValueInt64 (ifcfg, "IEEE_8021X_AUTH_RETRIES", 10, -1, G_MAXINT32, -1); - g_object_set (s_8021x, NM_SETTING_802_1X_AUTH_RETRIES, (gint) timeout, NULL); - return g_steal_pointer (&s_8021x); } diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index fafaa848bd..a2c0bc7f62 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -560,9 +560,6 @@ write_8021x_setting (NMConnection *connection, vint = nm_setting_802_1x_get_auth_timeout (s_8021x); svSetValueInt64_cond (ifcfg, "IEEE_8021X_AUTH_TIMEOUT", vint > 0, vint); - vint = nm_setting_802_1x_get_auth_retries (s_8021x); - svSetValueInt64_cond (ifcfg, "IEEE_8021X_AUTH_RETRIES", vint > 0, vint); - if (!write_8021x_certs (s_8021x, secrets, blobs, FALSE, ifcfg, error)) return FALSE; @@ -1723,7 +1720,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) guint32 n, i; GString *str; const char *master, *master_iface = NULL, *type; - gint i_int; + gint vint; const char *tmp; svSetValueStr (ifcfg, "NAME", nm_setting_connection_get_id (s_con)); @@ -1732,15 +1729,15 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) svSetValueStr (ifcfg, "DEVICE", nm_setting_connection_get_interface_name (s_con)); svSetValueBoolean (ifcfg, "ONBOOT", nm_setting_connection_get_autoconnect (s_con)); - i_int = nm_setting_connection_get_autoconnect_priority (s_con); - if (i_int != NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT) - svSetValueInt64 (ifcfg, "AUTOCONNECT_PRIORITY", i_int); + vint = nm_setting_connection_get_autoconnect_priority (s_con); + if (vint != NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT) + svSetValueInt64 (ifcfg, "AUTOCONNECT_PRIORITY", vint); else svUnsetValue (ifcfg, "AUTOCONNECT_PRIORITY"); - i_int = nm_setting_connection_get_autoconnect_retries (s_con); - if (i_int != -1) - svSetValueInt64 (ifcfg, "AUTOCONNECT_RETRIES", i_int); + vint = nm_setting_connection_get_autoconnect_retries (s_con); + if (vint != -1) + svSetValueInt64 (ifcfg, "AUTOCONNECT_RETRIES", vint); else svUnsetValue (ifcfg, "AUTOCONNECT_RETRIES"); @@ -1874,6 +1871,9 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) default: svUnsetValue (ifcfg, "CONNECTION_METERED"); } + + vint = nm_setting_connection_get_auth_retries (s_con); + svSetValueInt64_cond (ifcfg, "AUTH_RETRIES", vint >= 0, vint); } static char * |