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.
This commit is contained in:
@@ -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));
|
||||
|
||||
}
|
||||
|
@@ -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.
|
||||
@@ -356,6 +357,8 @@ NMSetting8021xCKFormat nm_setting_802_1x_get_phase2_private_key_format (NMSett
|
||||
|
||||
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);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user