summaryrefslogtreecommitdiff
path: root/libnm-core
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-10-24 10:13:11 +0200
committerThomas Haller <thaller@redhat.com>2017-10-31 19:35:33 +0100
commit89e518db5a332e1f6320005bc1ee2619f11ac34b (patch)
tree1d3656a2445178291abad703d5f0f88707a2ad64 /libnm-core
parentef60cf890fa741ac6d2f21d58cbe5e6d5b32a923 (diff)
downloadNetworkManager-89e518db5a332e1f6320005bc1ee2619f11ac34b.tar.gz
libnm,cli,ifcfg-rh: add NMSetting8021x:auth-retries property
Diffstat (limited to 'libnm-core')
-rw-r--r--libnm-core/nm-setting-8021x.c52
-rw-r--r--libnm-core/nm-setting-8021x.h3
2 files changed, 55 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-8021x.c b/libnm-core/nm-setting-8021x.c
index 82dc41dd55..b9f37df8d7 100644
--- a/libnm-core/nm-setting-8021x.c
+++ b/libnm-core/nm-setting-8021x.c
@@ -116,6 +116,7 @@ typedef struct {
NMSettingSecretFlags phase2_private_key_password_flags;
gboolean system_ca_certs;
gint auth_timeout;
+ gint auth_retries;
} NMSetting8021xPrivate;
enum {
@@ -164,6 +165,7 @@ enum {
PROP_PIN_FLAGS,
PROP_SYSTEM_CA_CERTS,
PROP_AUTH_TIMEOUT,
+ PROP_AUTH_RETRIES,
LAST_PROP
};
@@ -2745,6 +2747,25 @@ nm_setting_802_1x_get_auth_timeout (NMSetting8021x *setting)
return NM_SETTING_802_1X_GET_PRIVATE (setting)->auth_timeout;
}
+/**
+ * nm_setting_802_1x_get_auth_retries:
+ * @setting: the #NMSetting8021x
+ *
+ * Returns the value contained in the #NMSetting8021x:auth-retries property.
+ *
+ * Returns: the configured authentication retries in seconds. Zero means
+ * infinity and -1 means a global default value.
+ *
+ * Since: 1.10
+ **/
+gint
+nm_setting_802_1x_get_auth_retries (NMSetting8021x *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), -1);
+
+ return NM_SETTING_802_1X_GET_PRIVATE (setting)->auth_retries;
+}
+
static void
need_secrets_password (NMSetting8021x *self,
GPtrArray *secrets,
@@ -3623,6 +3644,9 @@ set_property (GObject *object, guint prop_id,
case PROP_AUTH_TIMEOUT:
priv->auth_timeout = g_value_get_int (value);
break;
+ case PROP_AUTH_RETRIES:
+ priv->auth_retries = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -3769,6 +3793,9 @@ get_property (GObject *object, guint prop_id,
case PROP_AUTH_TIMEOUT:
g_value_set_int (value, priv->auth_timeout);
break;
+ case PROP_AUTH_RETRIES:
+ g_value_set_int (value, priv->auth_retries);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -4825,4 +4852,29 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
NM_SETTING_PARAM_FUZZY_IGNORE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * NMSetting8021x:auth-retries:
+ *
+ * The number of retries for the authentication. Zero means to try indefinitely; -1 means
+ * to use a global default. If the global default is not set, the authentication
+ * retries for 3 times before failing the connection.
+ *
+ * Since: 1.10
+ **/
+ /* ---ifcfg-rh---
+ * property: auth-retries
+ * variable: IEEE_8021X_AUTH_RETRIES(+)
+ * default: 0
+ * description: Number of retries for the 802.1X authentication.
+ * ---end---
+ */
+ g_object_class_install_property
+ (object_class, PROP_AUTH_RETRIES,
+ g_param_spec_int (NM_SETTING_802_1X_AUTH_RETRIES, "", "",
+ -1, G_MAXINT32, -1,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_FUZZY_IGNORE |
+ G_PARAM_STATIC_STRINGS));
+
}
diff --git a/libnm-core/nm-setting-8021x.h b/libnm-core/nm-setting-8021x.h
index e1631e2d51..53f5bb5239 100644
--- a/libnm-core/nm-setting-8021x.h
+++ b/libnm-core/nm-setting-8021x.h
@@ -151,6 +151,7 @@ typedef enum { /*< underscore_name=nm_setting_802_1x_auth_flags >*/
#define NM_SETTING_802_1X_PIN_FLAGS "pin-flags"
#define NM_SETTING_802_1X_SYSTEM_CA_CERTS "system-ca-certs"
#define NM_SETTING_802_1X_AUTH_TIMEOUT "auth-timeout"
+#define NM_SETTING_802_1X_AUTH_RETRIES "auth-retries"
/* PRIVATE KEY NOTE: when setting PKCS#12 private keys directly via properties
* using the "blob" scheme, the data must be passed in PKCS#12 binary format.
@@ -361,6 +362,8 @@ NM_AVAILABLE_IN_1_8
NMSetting8021xAuthFlags nm_setting_802_1x_get_phase1_auth_flags (NMSetting8021x *setting);
NM_AVAILABLE_IN_1_8
gint nm_setting_802_1x_get_auth_timeout (NMSetting8021x *setting);
+NM_AVAILABLE_IN_1_10
+gint nm_setting_802_1x_get_auth_retries (NMSetting8021x *setting);
G_END_DECLS