diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c index ed1c164a5e..af3f4d5615 100644 --- a/libnm-core/nm-setting-connection.c +++ b/libnm-core/nm-setting-connection.c @@ -72,6 +72,7 @@ typedef struct { GSList *permissions; /* list of Permission structs */ gboolean autoconnect; gint autoconnect_priority; + gint autoconnect_retries; guint64 timestamp; gboolean read_only; char *zone; @@ -90,6 +91,7 @@ enum { PROP_PERMISSIONS, PROP_AUTOCONNECT, PROP_AUTOCONNECT_PRIORITY, + PROP_AUTOCONNECT_RETRIES, PROP_TIMESTAMP, PROP_READ_ONLY, PROP_ZONE, @@ -531,6 +533,25 @@ nm_setting_connection_get_autoconnect_priority (NMSettingConnection *setting) return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->autoconnect_priority; } +/** + * nm_setting_connection_get_autoconnect_retries: + * @setting: the #NMSettingConnection + * + * Returns the #NMSettingConnection:autoconnect-retries property of the connection. + * Zero means infinite, -1 means the global default value. + * + * Returns: the connection's autoconnect retries + * + * Since: 1.6 + **/ +gint +nm_setting_connection_get_autoconnect_retries (NMSettingConnection *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_CONNECTION (setting), -1); + + return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->autoconnect_retries; +} + /** * nm_setting_connection_get_timestamp: * @setting: the #NMSettingConnection @@ -1210,6 +1231,9 @@ set_property (GObject *object, guint prop_id, case PROP_AUTOCONNECT_PRIORITY: priv->autoconnect_priority = g_value_get_int (value); break; + case PROP_AUTOCONNECT_RETRIES: + priv->autoconnect_retries = g_value_get_int (value); + break; case PROP_TIMESTAMP: priv->timestamp = g_value_get_uint64 (value); break; @@ -1296,6 +1320,9 @@ get_property (GObject *object, guint prop_id, case PROP_AUTOCONNECT_PRIORITY: g_value_set_int (value, nm_setting_connection_get_autoconnect_priority (setting)); break; + case PROP_AUTOCONNECT_RETRIES: + g_value_set_int (value, nm_setting_connection_get_autoconnect_retries (setting)); + break; case PROP_TIMESTAMP: g_value_set_uint64 (value, nm_setting_connection_get_timestamp (setting)); break; @@ -1571,6 +1598,23 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingConnection:autoconnect-retries: + * + * The number of times a connection should be tried when autoctivating before + * giving up. Zero means forever, -1 means the global default (4 times if not + * overridden). + */ + g_object_class_install_property + (object_class, PROP_AUTOCONNECT_RETRIES, + g_param_spec_int (NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES, "", "", + -1, G_MAXINT32, -1, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); + /** * NMSettingConnection:timestamp: * diff --git a/libnm-core/nm-setting-connection.h b/libnm-core/nm-setting-connection.h index 67263d1f01..89fa64ce6d 100644 --- a/libnm-core/nm-setting-connection.h +++ b/libnm-core/nm-setting-connection.h @@ -51,6 +51,7 @@ G_BEGIN_DECLS #define NM_SETTING_CONNECTION_TYPE "type" #define NM_SETTING_CONNECTION_AUTOCONNECT "autoconnect" #define NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY "autoconnect-priority" +#define NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES "autoconnect-retries" #define NM_SETTING_CONNECTION_TIMESTAMP "timestamp" #define NM_SETTING_CONNECTION_READ_ONLY "read-only" #define NM_SETTING_CONNECTION_PERMISSIONS "permissions" @@ -123,6 +124,8 @@ const char *nm_setting_connection_get_interface_name (NMSettingConnection *set const char *nm_setting_connection_get_connection_type (NMSettingConnection *setting); gboolean nm_setting_connection_get_autoconnect (NMSettingConnection *setting); gint nm_setting_connection_get_autoconnect_priority (NMSettingConnection *setting); +NM_AVAILABLE_IN_1_6 +gint nm_setting_connection_get_autoconnect_retries (NMSettingConnection *setting); guint64 nm_setting_connection_get_timestamp (NMSettingConnection *setting); gboolean nm_setting_connection_get_read_only (NMSettingConnection *setting); diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index a0579a7027..68724721e4 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -1922,6 +1922,7 @@ test_connection_diff_a_only (void) { NM_SETTING_CONNECTION_TIMESTAMP, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_CONNECTION_AUTOCONNECT, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_CONNECTION_READ_ONLY, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_CONNECTION_PERMISSIONS, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_CONNECTION_ZONE, NM_SETTING_DIFF_RESULT_IN_A }, diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 46e91d9e93..b07b1d5672 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1088,6 +1088,7 @@ libnm_1_6_0 { global: nm_capability_get_type; nm_connection_get_setting_proxy; + nm_setting_connection_get_autoconnect_retries; nm_setting_proxy_get_type; nm_setting_proxy_new; nm_setting_proxy_get_method;