summary refs log tree commit diff
path: root/src/libnm-core-impl/nm-setting-ip6-config.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2024-05-05 00:07:30 +0200
committerMichael Biebl <biebl@debian.org>2024-05-05 00:07:30 +0200
commit34bb501be08aa2b313d88e67d6e0a7e0a3f9cfa6 (patch)
tree4e6220877828be4c6f261de09ec0cb2d80e32389 /src/libnm-core-impl/nm-setting-ip6-config.c
parentbba2e4b4de668db525cbfdfc35292e5a0b51671a (diff)
New upstream version 1.47.90 upstream/1.47.90
Diffstat (limited to 'src/libnm-core-impl/nm-setting-ip6-config.c')
-rw-r--r--src/libnm-core-impl/nm-setting-ip6-config.c100
1 files changed, 95 insertions, 5 deletions
diff --git a/src/libnm-core-impl/nm-setting-ip6-config.c b/src/libnm-core-impl/nm-setting-ip6-config.c
index 42bb2571..335700bf 100644
--- a/src/libnm-core-impl/nm-setting-ip6-config.c
+++ b/src/libnm-core-impl/nm-setting-ip6-config.c
@@ -40,6 +40,8 @@
 /*****************************************************************************/
 
 NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_IP6_PRIVACY,
+                                  PROP_TEMP_VALID_LIFETIME,
+                                  PROP_TEMP_PREFERRED_LIFETIME,
                                   PROP_ADDR_GEN_MODE,
                                   PROP_TOKEN,
                                   PROP_DHCP_DUID,
@@ -54,6 +56,8 @@ typedef struct {
     char   *dhcp_duid;
     char   *dhcp_pd_hint;
     int     ip6_privacy;
+    gint32  temp_valid_lifetime;
+    gint32  temp_preferred_lifetime;
     gint32  addr_gen_mode;
     gint32  ra_timeout;
     guint32 mtu;
@@ -98,6 +102,44 @@ nm_setting_ip6_config_get_ip6_privacy(NMSettingIP6Config *setting)
 }
 
 /**
+ * nm_setting_ip6_config_get_temp_valid_lifetime:
+ * @setting: the #NMSettingIP6Config
+ *
+ * Returns the value contained in the #NMSettingIP6Config:temp-valid-lifetime
+ * property.
+ *
+ * Returns: The valid lifetime of autogenerated temporary addresses.
+ *
+ * Since: 1.48
+ **/
+gint32
+nm_setting_ip6_config_get_temp_valid_lifetime(NMSettingIP6Config *setting)
+{
+    g_return_val_if_fail(NM_IS_SETTING_IP6_CONFIG(setting), 0);
+
+    return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->temp_valid_lifetime;
+}
+
+/**
+ * nm_setting_ip6_config_get_temp_preferred_lifetime:
+ * @setting: the #NMSettingIP6Config
+ *
+ * Returns the value contained in the #NMSettingIP6Config:temp-preferred-lifetime
+ * property.
+ *
+ * Returns: The preferred lifetime of autogenerated temporary addresses.
+ *
+ * Since: 1.48
+ **/
+gint32
+nm_setting_ip6_config_get_temp_preferred_lifetime(NMSettingIP6Config *setting)
+{
+    g_return_val_if_fail(NM_IS_SETTING_IP6_CONFIG(setting), 0);
+
+    return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->temp_preferred_lifetime;
+}
+
+/**
  * nm_setting_ip6_config_get_dhcp_pd_hint:
  * @setting: the #NMSettingIP6Config
  *
@@ -921,11 +963,11 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
      * 0: disabled, 1: enabled (prefer public address), 2: enabled (prefer temporary
      * addresses).
      *
-     * Having a per-connection setting set to "-1" (unknown) means fallback to
-     * global configuration "ipv6.ip6-privacy".
-     *
-     * If also global configuration is unspecified or set to "-1", fallback to read
-     * "/proc/sys/net/ipv6/conf/default/use_tempaddr".
+     * If set to "-1" (unknown) for a connection, the value is taken from the
+     * global "ipv6.ip6-privacy" setting. If the global setting is unspecified
+     * or also set to "-1", the value is set from the original value of
+     * "/proc/sys/net/ipv6/conf/<iface>/use_tempaddr" from before NetworkManager
+     * started.
      *
      * Note that this setting is distinct from the Stable Privacy addresses
      * that can be enabled with the "addr-gen-mode" property's "stable-privacy"
@@ -953,6 +995,54 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
                                                  ip6_privacy);
 
     /**
+     * NMSettingIP6Config:temp-valid-lifetime:
+     *
+     * The valid lifetime of autogenerated temporary addresses, in seconds.
+     *
+     * If set to "0" (unknown) for a connection, the value is taken from the
+     * global "ipv6.temp-valid-lifetime" setting. If the global setting is
+     * unspecified or also set to "0", the value is set from the original value
+     * of "/proc/sys/net/ipv6/conf/<iface>/temp_valid_lft" from before
+     * NetworkManager started.
+     *
+     * Since: 1.48
+     **/
+    _nm_setting_property_define_direct_int32(properties_override,
+                                             obj_properties,
+                                             NM_SETTING_IP6_CONFIG_TEMP_VALID_LIFETIME,
+                                             PROP_TEMP_VALID_LIFETIME,
+                                             0,
+                                             G_MAXINT32,
+                                             0,
+                                             NM_SETTING_PARAM_FUZZY_IGNORE,
+                                             NMSettingIP6ConfigPrivate,
+                                             temp_valid_lifetime);
+
+    /**
+     * NMSettingIP6Config:temp-preferred-lifetime:
+     *
+     * The preferred lifetime of autogenerated temporary addresses, in seconds.
+     *
+     * If set to "0" (unknown) for a connection, the value is taken from the
+     * global "ipv6.temp-preferred-lifetime" setting. If the global setting is
+     * unspecified or also set to "0", the value is set from the original value
+     * of "/proc/sys/net/ipv6/conf/<iface>/temp_prefered_lft" from before
+     * NetworkManager started.
+     *
+     * Since: 1.48
+     **/
+    _nm_setting_property_define_direct_int32(properties_override,
+                                             obj_properties,
+                                             NM_SETTING_IP6_CONFIG_TEMP_PREFERRED_LIFETIME,
+                                             PROP_TEMP_PREFERRED_LIFETIME,
+                                             0,
+                                             G_MAXINT32,
+                                             0,
+                                             NM_SETTING_PARAM_FUZZY_IGNORE,
+                                             NMSettingIP6ConfigPrivate,
+                                             temp_preferred_lifetime);
+
+    /**
      * NMSettingIP6Config:addr-gen-mode:
      *
      * Configure the method for creating the IPv6 interface identifier of