From 8ad6f0c7ec841c2bf41f238585f9452b4a9db933 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 14 Sep 2020 09:49:28 +0200 Subject: editor: add 'default' item to the ip6-privacy combo box Add missing 'default' item to the ip6-privacy combo box in the IPv6 page. The enum value is called 'unknown' in NetworkManager, but 'default' seems more clear. https://gitlab.gnome.org/GNOME/network-manager-applet/-/issues/111 --- src/connection-editor/ce-page-ip6.ui | 4 ++++ src/connection-editor/page-ip6.c | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/connection-editor/ce-page-ip6.ui b/src/connection-editor/ce-page-ip6.ui index 0323c66e..290d62f0 100644 --- a/src/connection-editor/ce-page-ip6.ui +++ b/src/connection-editor/ce-page-ip6.ui @@ -31,6 +31,9 @@ + + Default + Disabled @@ -298,6 +301,7 @@ True False + If enabled, it makes the kernel generate a temporary IPv6 address in addition to the public one generated from MAC address. This enhances privacy, but could cause problems in some applications. If set to "Default", the value from NetworkManager global configuration is used. If that is also unset, use the kernel default value read from file "/proc/sys/net/ipv6/conf/default/use_tempaddr" False model2 diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c index 13cbc3cc..cf552cb1 100644 --- a/src/connection-editor/page-ip6.c +++ b/src/connection-editor/page-ip6.c @@ -98,9 +98,10 @@ typedef struct { #define IP6_METHOD_SHARED 6 #define IP6_METHOD_DISABLED 7 -#define IP6_PRIVACY_DISABLED 0 -#define IP6_PRIVACY_PREFER_PUBLIC 1 -#define IP6_PRIVACY_PREFER_TEMP 2 +#define IP6_PRIVACY_UNKNOWN 0 +#define IP6_PRIVACY_DISABLED 1 +#define IP6_PRIVACY_PREFER_PUBLIC 2 +#define IP6_PRIVACY_PREFER_TEMP 3 #define IP6_ADDR_GEN_MODE_EUI64 0 #define IP6_ADDR_GEN_MODE_STABLE 1 @@ -481,6 +482,9 @@ populate_ui (CEPageIP6 *self) /* IPv6 privacy extensions */ ip6_privacy = nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (setting)); switch (ip6_privacy) { + case NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN: + ip6_privacy_idx = IP6_PRIVACY_UNKNOWN; + break; case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED: ip6_privacy_idx = IP6_PRIVACY_DISABLED; break; @@ -491,7 +495,7 @@ populate_ui (CEPageIP6 *self) ip6_privacy_idx = IP6_PRIVACY_PREFER_TEMP; break; default: - ip6_privacy_idx = IP6_PRIVACY_DISABLED; + ip6_privacy_idx = IP6_PRIVACY_UNKNOWN; break; } gtk_combo_box_set_active (priv->ip6_privacy_combo, ip6_privacy_idx); @@ -1384,6 +1388,9 @@ ui_to_setting (CEPageIP6 *self, GError **error) /* IPv6 Privacy */ switch (gtk_combo_box_get_active (priv->ip6_privacy_combo)) { + case IP6_PRIVACY_UNKNOWN: + ip6_privacy = NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN; + break; case IP6_PRIVACY_DISABLED: ip6_privacy = NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED; break; -- cgit v1.2.1