summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-01-19 17:25:19 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-02-21 09:18:53 +0100
commit078bd7b1a98c83e67c52143ac0ff38a66a3bea18 (patch)
tree129b7e1492bcb627270c62d1509732fd247b99bd
parent9952280d4067bf121f0500f46dfc6fda784083d8 (diff)
downloadNetworkManager-078bd7b1a98c83e67c52143ac0ff38a66a3bea18.tar.gz
libnm-core: add auth-timeout property to the 802.1x setting
The property can be used to tune the authentication timeout. It's especially useful to speed up the failure in case the port doesn't support 802.1X and make NM try a different, non-authenticated connection.
-rw-r--r--libnm-core/nm-setting-8021x.c44
-rw-r--r--libnm-core/nm-setting-8021x.h5
-rw-r--r--libnm/libnm.ver1
3 files changed, 49 insertions, 1 deletions
diff --git a/libnm-core/nm-setting-8021x.c b/libnm-core/nm-setting-8021x.c
index c90e42fa40..869182feb6 100644
--- a/libnm-core/nm-setting-8021x.c
+++ b/libnm-core/nm-setting-8021x.c
@@ -115,6 +115,7 @@ typedef struct {
char *phase2_private_key_password;
NMSettingSecretFlags phase2_private_key_password_flags;
gboolean system_ca_certs;
+ gint auth_timeout;
} NMSetting8021xPrivate;
enum {
@@ -162,6 +163,7 @@ enum {
PROP_PIN,
PROP_PIN_FLAGS,
PROP_SYSTEM_CA_CERTS,
+ PROP_AUTH_TIMEOUT,
LAST_PROP
};
@@ -2724,6 +2726,25 @@ nm_setting_802_1x_get_phase2_private_key_format (NMSetting8021x *setting)
return NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
}
+/**
+ * nm_setting_802_1x_get_auth_timeout:
+ * @setting: the #NMSetting8021x
+ *
+ * Returns the value contained in the #NMSetting8021x:auth-timeout property.
+ *
+ * Returns: the configured authentication timeout in seconds. Zero means the
+ * global default value.
+ *
+ * Since: 1.8
+ **/
+gint
+nm_setting_802_1x_get_auth_timeout (NMSetting8021x *setting)
+{
+ g_return_val_if_fail (NM_IS_SETTING_802_1X (setting), 0);
+
+ return NM_SETTING_802_1X_GET_PRIVATE (setting)->auth_timeout;
+}
+
static void
need_secrets_password (NMSetting8021x *self,
GPtrArray *secrets,
@@ -3590,6 +3611,9 @@ set_property (GObject *object, guint prop_id,
case PROP_SYSTEM_CA_CERTS:
priv->system_ca_certs = g_value_get_boolean (value);
break;
+ case PROP_AUTH_TIMEOUT:
+ priv->auth_timeout = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -3733,6 +3757,9 @@ get_property (GObject *object, guint prop_id,
case PROP_SYSTEM_CA_CERTS:
g_value_set_boolean (value, priv->system_ca_certs);
break;
+ case PROP_AUTH_TIMEOUT:
+ g_value_set_int (value, priv->auth_timeout);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -4763,4 +4790,21 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSetting8021x:auth-timeout:
+ *
+ * A timeout for the authentication. Zero means the global default; if the
+ * global default is not set, the authentication timeout is 25 seconds.
+ *
+ * Since: 1.8
+ **/
+ g_object_class_install_property
+ (object_class, PROP_AUTH_TIMEOUT,
+ g_param_spec_int (NM_SETTING_802_1X_AUTH_TIMEOUT, "", "",
+ 0, G_MAXINT32, 0,
+ G_PARAM_READWRITE |
+ 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 15ba07b3ac..a47c26a722 100644
--- a/libnm-core/nm-setting-8021x.h
+++ b/libnm-core/nm-setting-8021x.h
@@ -150,6 +150,7 @@ typedef enum { /*< underscore_name=nm_setting_802_1x_auth_flags >*/
#define NM_SETTING_802_1X_PIN "pin"
#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"
/* 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.
@@ -355,7 +356,9 @@ NMSettingSecretFlags nm_setting_802_1x_get_phase2_private_key_password_flags (
NMSetting8021xCKFormat nm_setting_802_1x_get_phase2_private_key_format (NMSetting8021x *setting);
NM_AVAILABLE_IN_1_8
-NMSetting8021xAuthFlags nm_setting_802_1x_get_phase1_auth_flags (NMSetting8021x *setting);
+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);
G_END_DECLS
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index 45953911d5..5473ffaa2f 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -1147,6 +1147,7 @@ global:
libnm_1_8_0 {
global:
nm_setting_802_1x_auth_flags_get_type;
+ nm_setting_802_1x_get_auth_timeout;
nm_setting_802_1x_get_ca_cert_password;
nm_setting_802_1x_get_ca_cert_password_flags;
nm_setting_802_1x_get_client_cert_password;