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]
This commit is contained in:

committed by
Beniamino Galvani

parent
f607a16994
commit
31ea5a99cb
@@ -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));
|
||||
}
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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 },
|
||||
} },
|
||||
};
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user