diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-09-07 18:00:10 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-01-12 14:35:34 +0100 |
commit | d466d6e331588a02a217e12aebd5db37aa75cccf (patch) | |
tree | 8fb870d564b4bfa738d962407e224fb3ed7699df | |
parent | 49832fd3943d3551f81e31c9ab8366ff6d8d49b9 (diff) | |
download | NetworkManager-d466d6e331588a02a217e12aebd5db37aa75cccf.tar.gz |
libnm: add NMSettingIPConfig 'dad-timeout' property
The property is used to control duplicate address detection:
* -1 means default value
* 0 means no DAD is performed
* > 0 means timeout (in milliseconds) for arping responses
[bgalvani: moved setting from NMSettingIP4Config]
-rw-r--r-- | libnm-core/nm-setting-ip-config.c | 45 | ||||
-rw-r--r-- | libnm-core/nm-setting-ip-config.h | 5 | ||||
-rw-r--r-- | libnm-core/tests/test-general.c | 1 | ||||
-rw-r--r-- | libnm/libnm.ver | 1 |
4 files changed, 52 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c index 7e719aae19..36f868ebfc 100644 --- a/libnm-core/nm-setting-ip-config.c +++ b/libnm-core/nm-setting-ip-config.c @@ -1093,6 +1093,7 @@ typedef struct { gboolean dhcp_send_hostname; gboolean never_default; gboolean may_fail; + gint dad_timeout; } NMSettingIPConfigPrivate; enum { @@ -1111,6 +1112,7 @@ enum { PROP_DHCP_SEND_HOSTNAME, PROP_NEVER_DEFAULT, PROP_MAY_FAIL, + PROP_DAD_TIMEOUT, LAST_PROP }; @@ -2055,6 +2057,22 @@ nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting) return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->may_fail; } +/** + * nm_setting_ip_config_get_dad_timeout: + * @setting: the #NMSettingIPConfig + * + * Returns: the #NMSettingIPConfig:dad-timeout property. + * + * Since: 1.2 + **/ +gint +nm_setting_ip_config_get_dad_timeout (NMSettingIPConfig *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP_CONFIG (setting), 0); + + return NM_SETTING_IP_CONFIG_GET_PRIVATE (setting)->dad_timeout; +} + static gboolean verify_label (const char *label) { @@ -2315,6 +2333,9 @@ set_property (GObject *object, guint prop_id, case PROP_MAY_FAIL: priv->may_fail = g_value_get_boolean (value); break; + case PROP_DAD_TIMEOUT: + priv->dad_timeout = g_value_get_int (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2375,6 +2396,9 @@ get_property (GObject *object, guint prop_id, case PROP_MAY_FAIL: g_value_set_boolean (value, priv->may_fail); break; + case PROP_DAD_TIMEOUT: + g_value_set_int (value, nm_setting_ip_config_get_dad_timeout (setting)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -2656,4 +2680,25 @@ nm_setting_ip_config_class_init (NMSettingIPConfigClass *setting_class) G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingIPConfig:dad-timeout: + * + * Timeout in milliseconds used to check for the presence of duplicate IP + * addresses on the network. If an address conflict is detected, the + * activation will fail. A zero value means that no duplicate address + * detection is performed, -1 means the default value (either configuration + * ipvx.dad-timeout override or 3 seconds). A value greater than zero is a + * timeout in milliseconds. + * + * Since: 1.2 + **/ + g_object_class_install_property + (object_class, PROP_DAD_TIMEOUT, + g_param_spec_int (NM_SETTING_IP_CONFIG_DAD_TIMEOUT, "", "", + -1, NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX, -1, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS)); } diff --git a/libnm-core/nm-setting-ip-config.h b/libnm-core/nm-setting-ip-config.h index 6e8c02021a..3cd0daf763 100644 --- a/libnm-core/nm-setting-ip-config.h +++ b/libnm-core/nm-setting-ip-config.h @@ -130,6 +130,8 @@ void nm_ip_route_set_attribute (NMIPRoute *route, #define NM_IS_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_IP_CONFIG)) #define NM_SETTING_IP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigClass)) +#define NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX 30000 + #define NM_SETTING_IP_CONFIG_METHOD "method" #define NM_SETTING_IP_CONFIG_DNS "dns" #define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search" @@ -144,6 +146,7 @@ void nm_ip_route_set_attribute (NMIPRoute *route, #define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname" #define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default" #define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail" +#define NM_SETTING_IP_CONFIG_DAD_TIMEOUT "dad-timeout" #define NM_SETTING_DNS_OPTION_DEBUG "debug" #define NM_SETTING_DNS_OPTION_NDOTS "ndots" @@ -245,6 +248,8 @@ gboolean nm_setting_ip_config_get_dhcp_send_hostname (NMSettingIPConfig gboolean nm_setting_ip_config_get_never_default (NMSettingIPConfig *setting); gboolean nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting); +NM_AVAILABLE_IN_1_2 +gint nm_setting_ip_config_get_dad_timeout (NMSettingIPConfig *setting); G_END_DECLS diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index e8eb0bafb5..99b96b2ff5 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -2046,6 +2046,7 @@ test_connection_diff_a_only (void) { NM_SETTING_IP4_CONFIG_DHCP_FQDN, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_CONFIG_NEVER_DEFAULT, NM_SETTING_DIFF_RESULT_IN_A }, { NM_SETTING_IP_CONFIG_MAY_FAIL, NM_SETTING_DIFF_RESULT_IN_A }, + { NM_SETTING_IP_CONFIG_DAD_TIMEOUT, NM_SETTING_DIFF_RESULT_IN_A }, { NULL, NM_SETTING_DIFF_RESULT_UNKNOWN }, } }, }; diff --git a/libnm/libnm.ver b/libnm/libnm.ver index ed008eee4c..136375ee79 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -944,6 +944,7 @@ global: nm_setting_ip6_config_get_addr_gen_mode; nm_setting_ip_config_add_dns_option; nm_setting_ip_config_clear_dns_options; + nm_setting_ip_config_get_dad_timeout; nm_setting_ip_config_get_dns_option; nm_setting_ip_config_get_num_dns_options; nm_setting_ip_config_has_dns_options; |