[network-manager-applet/bg/ip6-privacy-default] editor: add 'default' item to the ip6-privacy combo box




commit 8ad6f0c7ec841c2bf41f238585f9452b4a9db933
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Mon Sep 14 09:49:28 2020 +0200

    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 0323c66e8..290d62f0a 100644
--- a/src/connection-editor/ce-page-ip6.ui
+++ b/src/connection-editor/ce-page-ip6.ui
@@ -31,6 +31,9 @@
       <column type="gchararray"/>
     </columns>
     <data>
+      <row>
+        <col id="0" translatable="yes">Default</col>
+      </row>
       <row>
         <col id="0" translatable="yes">Disabled</col>
       </row>
@@ -298,6 +301,7 @@
                   <object class="GtkComboBox" id="ip6_privacy_combo">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="tooltip_text" translatable="yes">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"</property>
                     <property name="hexpand">False</property>
                     <property name="model">model2</property>
                     <child>
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 13cbc3cc0..cf552cb13 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]