diff options
author | Thomas Haller <thaller@redhat.com> | 2020-02-13 15:41:35 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-02-17 14:43:13 +0100 |
commit | de4aeb34e3d6b4e3b1d3f4f7673a497e3e179c6b (patch) | |
tree | c0883293becf4342f800c9997cbb6c239ad8d1ae /libnm-core | |
parent | 0d8f55a1cbb8fb0e3167ac53a5ec9bb5f7f7e81b (diff) | |
download | NetworkManager-de4aeb34e3d6b4e3b1d3f4f7673a497e3e179c6b.tar.gz |
libnm,cli,ifcfg-rh: add ipv6.ra-timeout configuration option
Diffstat (limited to 'libnm-core')
-rw-r--r-- | libnm-core/nm-setting-ip6-config.c | 51 | ||||
-rw-r--r-- | libnm-core/nm-setting-ip6-config.h | 4 |
2 files changed, 55 insertions, 0 deletions
diff --git a/libnm-core/nm-setting-ip6-config.c b/libnm-core/nm-setting-ip6-config.c index d4c89939c0..c7c2c48de8 100644 --- a/libnm-core/nm-setting-ip6-config.c +++ b/libnm-core/nm-setting-ip6-config.c @@ -43,6 +43,7 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE ( PROP_ADDR_GEN_MODE, PROP_TOKEN, PROP_DHCP_DUID, + PROP_RA_TIMEOUT, ); typedef struct { @@ -50,6 +51,7 @@ typedef struct { char *dhcp_duid; NMSettingIP6ConfigPrivacy ip6_privacy; NMSettingIP6ConfigAddrGenMode addr_gen_mode; + gint32 ra_timeout; } NMSettingIP6ConfigPrivate; G_DEFINE_TYPE (NMSettingIP6Config, nm_setting_ip6_config, NM_TYPE_SETTING_IP_CONFIG) @@ -134,6 +136,23 @@ nm_setting_ip6_config_get_dhcp_duid (NMSettingIP6Config *setting) return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dhcp_duid; } +/** + * nm_setting_ip6_config_get_ra_timeout: + * @setting: the #NMSettingIP6Config + * + * Returns: The configured %NM_SETTING_IP6_CONFIG_RA_TIMEOUT value with the + * timeout for router advertisements in seconds. + * + * Since: 1.24 + **/ +gint32 +nm_setting_ip6_config_get_ra_timeout (NMSettingIP6Config *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0); + + return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ra_timeout; +} + static gboolean verify (NMSetting *setting, NMConnection *connection, GError **error) { @@ -475,6 +494,9 @@ get_property (GObject *object, guint prop_id, case PROP_DHCP_DUID: g_value_set_string (value, priv->dhcp_duid); break; + case PROP_RA_TIMEOUT: + g_value_set_int (value, priv->ra_timeout); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -502,6 +524,9 @@ set_property (GObject *object, guint prop_id, g_free (priv->dhcp_duid); priv->dhcp_duid = g_value_dup_string (value); break; + case PROP_RA_TIMEOUT: + priv->ra_timeout = g_value_get_int (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -839,6 +864,32 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *klass) G_PARAM_STATIC_STRINGS); /** + * NMSettingIP6Config:ra-timeout: + * + * A timeout for waiting Router Advertisements in seconds. If zero (the default), a + * globally configured default is used. If still unspecified, the timeout depends on the + * sysctl settings of the device. + * + * Set to 2147483647 (MAXINT32) for infinity. + * + * Since: 1.24 + **/ + /* ---ifcfg-rh--- + * property: dhcp-timeout + * variable: IPV6_RA_TIMEOUT(+) + * description: A timeout for waiting Router Advertisements in seconds. + * example: IPV6_RA_TIMEOUT=10 + * ---end--- + */ + + obj_properties[PROP_RA_TIMEOUT] = + g_param_spec_int (NM_SETTING_IP6_CONFIG_RA_TIMEOUT, "", "", + 0, G_MAXINT32, 0, + G_PARAM_READWRITE | + NM_SETTING_PARAM_FUZZY_IGNORE | + G_PARAM_STATIC_STRINGS); + + /** * NMSettingIP6Config:dhcp-duid: * * A string containing the DHCPv6 Unique Identifier (DUID) used by the dhcp diff --git a/libnm-core/nm-setting-ip6-config.h b/libnm-core/nm-setting-ip6-config.h index 86a39a8ee4..e6eb49bb02 100644 --- a/libnm-core/nm-setting-ip6-config.h +++ b/libnm-core/nm-setting-ip6-config.h @@ -31,6 +31,8 @@ G_BEGIN_DECLS #define NM_SETTING_IP6_CONFIG_DHCP_DUID "dhcp-duid" +#define NM_SETTING_IP6_CONFIG_RA_TIMEOUT "ra-timeout" + /** * NM_SETTING_IP6_CONFIG_METHOD_IGNORE: * @@ -159,6 +161,8 @@ NM_AVAILABLE_IN_1_4 const char *nm_setting_ip6_config_get_token (NMSettingIP6Config *setting); NM_AVAILABLE_IN_1_12 const char *nm_setting_ip6_config_get_dhcp_duid (NMSettingIP6Config *setting); +NM_AVAILABLE_IN_1_24 +gint32 nm_setting_ip6_config_get_ra_timeout (NMSettingIP6Config *setting); G_END_DECLS |