diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2015-09-28 19:19:29 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2015-10-06 14:16:55 +0200 |
commit | c17ab1b6ff066c6481c365c568fc3fa1a2d2cdaf (patch) | |
tree | e0d73013641dc36062bc1fd6a1cbc65b3d7a7d06 | |
parent | 3f0d595cc827d9e1117bc5c796aa11185ba8c5d7 (diff) | |
download | NetworkManager-c17ab1b6ff066c6481c365c568fc3fa1a2d2cdaf.tar.gz |
libnm-util: add ipv4.dhcp-timeout property
https://bugzilla.redhat.com/show_bug.cgi?id=1262922
-rw-r--r-- | libnm-util/libnm-util.ver | 1 | ||||
-rw-r--r-- | libnm-util/nm-setting-ip4-config.c | 39 | ||||
-rw-r--r-- | libnm-util/nm-setting-ip4-config.h | 3 | ||||
-rw-r--r-- | libnm-util/tests/test-general.c | 1 |
4 files changed, 44 insertions, 0 deletions
diff --git a/libnm-util/libnm-util.ver b/libnm-util/libnm-util.ver index ae34142073..1ad853f5fb 100644 --- a/libnm-util/libnm-util.ver +++ b/libnm-util/libnm-util.ver @@ -355,6 +355,7 @@ global: nm_setting_ip4_config_get_dhcp_client_id; nm_setting_ip4_config_get_dhcp_hostname; nm_setting_ip4_config_get_dhcp_send_hostname; + nm_setting_ip4_config_get_dhcp_timeout; nm_setting_ip4_config_get_dns; nm_setting_ip4_config_get_dns_search; nm_setting_ip4_config_get_ignore_auto_dns; diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c index 707cd48ba6..efc226b3bf 100644 --- a/libnm-util/nm-setting-ip4-config.c +++ b/libnm-util/nm-setting-ip4-config.c @@ -82,6 +82,7 @@ typedef struct { char *dhcp_client_id; gboolean dhcp_send_hostname; char *dhcp_hostname; + int dhcp_timeout; gboolean never_default; gboolean may_fail; } NMSettingIP4ConfigPrivate; @@ -97,6 +98,7 @@ enum { PROP_IGNORE_AUTO_ROUTES, PROP_IGNORE_AUTO_DNS, PROP_DHCP_CLIENT_ID, + PROP_DHCP_TIMEOUT, PROP_DHCP_SEND_HOSTNAME, PROP_DHCP_HOSTNAME, PROP_NEVER_DEFAULT, @@ -801,6 +803,24 @@ nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting) } /** + * nm_setting_ip4_config_get_dhcp_timeout: + * @setting: the #NMSettingIP4Config + * + * Returns the value contained in the #NMSettingIP4Config:dhcp-timeout + * property. + * + * Returns: The number of seconds after which unfinished DHCP transaction + * fails or zero for "default". + **/ +int +nm_setting_ip4_config_get_dhcp_timeout (NMSettingIP4Config *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), 0); + + return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_timeout; +} + +/** * nm_setting_ip4_config_get_never_default: * @setting: the #NMSettingIP4Config * @@ -1050,6 +1070,9 @@ set_property (GObject *object, guint prop_id, g_free (priv->dhcp_hostname); priv->dhcp_hostname = g_value_dup_string (value); break; + case PROP_DHCP_TIMEOUT: + priv->dhcp_timeout = g_value_get_uint (value); + break; case PROP_NEVER_DEFAULT: priv->never_default = g_value_get_boolean (value); break; @@ -1103,6 +1126,9 @@ get_property (GObject *object, guint prop_id, case PROP_DHCP_HOSTNAME: g_value_set_string (value, nm_setting_ip4_config_get_dhcp_hostname (setting)); break; + case PROP_DHCP_TIMEOUT: + g_value_set_uint (value, nm_setting_ip4_config_get_dhcp_timeout (setting)); + break; case PROP_NEVER_DEFAULT: g_value_set_boolean (value, priv->never_default); break; @@ -1326,6 +1352,19 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *setting_class) G_PARAM_STATIC_STRINGS)); /** + * NMSettingIP4Config:dhcp-timeout: + * + * Number of seconds after which the unfinished DHCP transaction fails + * or zero for default. + **/ + g_object_class_install_property + (object_class, PROP_DHCP_TIMEOUT, + g_param_spec_uint (NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + /** * NMSettingIP4Config:never-default: * * If %TRUE, this connection will never be the default IPv4 connection, diff --git a/libnm-util/nm-setting-ip4-config.h b/libnm-util/nm-setting-ip4-config.h index 6e9a9a227a..1365de291c 100644 --- a/libnm-util/nm-setting-ip4-config.h +++ b/libnm-util/nm-setting-ip4-config.h @@ -66,6 +66,7 @@ GQuark nm_setting_ip4_config_error_quark (void); #define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID "dhcp-client-id" #define NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname" #define NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME "dhcp-hostname" +#define NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT "dhcp-timeout" #define NM_SETTING_IP4_CONFIG_NEVER_DEFAULT "never-default" #define NM_SETTING_IP4_CONFIG_MAY_FAIL "may-fail" @@ -223,6 +224,8 @@ gboolean nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config * const char * nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting); gboolean nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting); const char * nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting); +NM_AVAILABLE_IN_1_2 +int nm_setting_ip4_config_get_dhcp_timeout (NMSettingIP4Config *setting); gboolean nm_setting_ip4_config_get_never_default (NMSettingIP4Config *setting); diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c index 2dfa0b6dc1..f35819e7ff 100644 --- a/libnm-util/tests/test-general.c +++ b/libnm-util/tests/test-general.c @@ -1283,6 +1283,7 @@ test_connection_diff_a_only (void) { NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A }, |