[network-manager-applet/jk/rh1501664-edit-addr-gen-mode] editor: allow setting IPv6 address generation mode (rh #1501664)
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/jk/rh1501664-edit-addr-gen-mode] editor: allow setting IPv6 address generation mode (rh #1501664)
- Date: Wed, 1 Nov 2017 19:54:23 +0000 (UTC)
commit d487bfe4ca5215fd032c8838ab5849343d3a87ab
Author: Jiří Klimeš <blueowl centrum cz>
Date: Wed Nov 1 20:45:10 2017 +0100
editor: allow setting IPv6 address generation mode (rh #1501664)
src/connection-editor/ce-page-ip6.ui | 46 ++++++++++++++++++++++++++++++++++
src/connection-editor/page-ip6.c | 34 +++++++++++++++++++++++++
2 files changed, 80 insertions(+), 0 deletions(-)
---
diff --git a/src/connection-editor/ce-page-ip6.ui b/src/connection-editor/ce-page-ip6.ui
index d3dd2cf..038785b 100644
--- a/src/connection-editor/ce-page-ip6.ui
+++ b/src/connection-editor/ce-page-ip6.ui
@@ -42,6 +42,20 @@
</row>
</data>
</object>
+ <object class="GtkListStore" id="model3">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">EUI64</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Stable privacy</col>
+ </row>
+ </data>
+ </object>
<object class="GtkVBox" id="IP6Page">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -290,6 +304,38 @@
<property name="top_attach">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="ip6_addr_gen_mode_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">IPv6 SLAAC _generation mode:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">ip6_addr_gen_mode_combo</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="ip6_addr_gen_mode_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">False</property>
+ <property name="model">model3</property>
+ <child>
+ <object class="GtkCellRendererText" id="renderer3"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 6e896c8..36cf279 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -75,6 +75,10 @@ typedef struct {
GtkWidget *ip6_privacy_label;
GtkComboBox *ip6_privacy_combo;
+ /* IPv6 SLAAC address generation mode combo */
+ GtkWidget *ip6_addr_gen_mode_label;
+ GtkComboBox *ip6_addr_gen_mode_combo;
+
/* IPv6 required */
GtkCheckButton *ip6_required;
@@ -106,6 +110,9 @@ typedef struct {
#define IP6_PRIVACY_PREFER_PUBLIC 1
#define IP6_PRIVACY_PREFER_TEMP 2
+#define IP6_ADDR_GEN_MODE_EUI64 0
+#define IP6_ADDR_GEN_MODE_STABLE 1
+
static void
ip6_private_init (CEPageIP6 *self, NMConnection *connection)
{
@@ -224,6 +231,9 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
priv->ip6_privacy_label = GTK_WIDGET (gtk_builder_get_object (builder, "ip6_privacy_label"));
priv->ip6_privacy_combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, "ip6_privacy_combo"));
+ priv->ip6_addr_gen_mode_label = GTK_WIDGET (gtk_builder_get_object (builder,
"ip6_addr_gen_mode_label"));
+ priv->ip6_addr_gen_mode_combo = GTK_COMBO_BOX (gtk_builder_get_object (builder,
"ip6_addr_gen_mode_combo"));
+
priv->ip6_required = GTK_CHECK_BUTTON (gtk_builder_get_object (builder, "ip6_required_checkbutton"));
/* Hide IP6-require button if it'll never be used for a particular method */
if ( priv->connection_type == NM_TYPE_SETTING_VPN
@@ -244,6 +254,7 @@ method_changed (GtkComboBox *combo, gpointer user_data)
gboolean dns_enabled = FALSE;
gboolean routes_enabled = FALSE;
gboolean ip6_privacy_enabled = FALSE;
+ gboolean ip6_addr_gen_mode_enabled = TRUE;
gboolean ip6_required_enabled = TRUE;
gboolean method_auto = FALSE;
GtkTreeIter iter;
@@ -290,6 +301,7 @@ method_changed (GtkComboBox *combo, gpointer user_data)
break;
case IP6_METHOD_IGNORE:
ip6_required_enabled = FALSE;
+ ip6_addr_gen_mode_enabled = FALSE;
break;
default:
break;
@@ -340,6 +352,9 @@ method_changed (GtkComboBox *combo, gpointer user_data)
gtk_widget_set_sensitive (priv->ip6_privacy_label, ip6_privacy_enabled);
gtk_widget_set_sensitive (GTK_WIDGET (priv->ip6_privacy_combo), ip6_privacy_enabled);
+ gtk_widget_set_sensitive (priv->ip6_addr_gen_mode_label, ip6_addr_gen_mode_enabled);
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->ip6_addr_gen_mode_combo), ip6_addr_gen_mode_enabled);
+
gtk_widget_set_sensitive (GTK_WIDGET (priv->ip6_required), ip6_required_enabled);
gtk_widget_set_sensitive (GTK_WIDGET (priv->routes_button), routes_enabled);
@@ -376,6 +391,8 @@ populate_ui (CEPageIP6 *self)
int method = IP6_METHOD_AUTO;
NMSettingIP6ConfigPrivacy ip6_privacy;
int ip6_privacy_idx = IP6_PRIVACY_DISABLED;
+ NMSettingIP6ConfigAddrGenMode ip6_addr_gen_mode;
+ int ip6_addr_gen_mode_idx = IP6_ADDR_GEN_MODE_EUI64;
GString *string = NULL;
SetMethodInfo info;
const char *str_method;
@@ -477,6 +494,14 @@ populate_ui (CEPageIP6 *self)
}
gtk_combo_box_set_active (priv->ip6_privacy_combo, ip6_privacy_idx);
+ /* IPv6 address generation mode */
+ ip6_addr_gen_mode = nm_setting_ip6_config_get_addr_gen_mode (NM_SETTING_IP6_CONFIG (setting));
+ if (ip6_addr_gen_mode == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64)
+ ip6_addr_gen_mode_idx = IP6_ADDR_GEN_MODE_EUI64;
+ else
+ ip6_addr_gen_mode_idx = IP6_ADDR_GEN_MODE_STABLE;
+ gtk_combo_box_set_active (priv->ip6_addr_gen_mode_combo, ip6_addr_gen_mode_idx);
+
/* IPv6 required */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->ip6_required),
!nm_setting_ip_config_get_may_fail (setting));
@@ -1153,6 +1178,7 @@ finish_setup (CEPageIP6 *self, gpointer unused, GError *error, gpointer user_dat
g_signal_connect (priv->dns_servers, "insert-text", G_CALLBACK (dns_servers_filter_cb), self);
g_signal_connect_swapped (priv->dns_searches, "changed", G_CALLBACK (ce_page_changed), self);
g_signal_connect_swapped (priv->ip6_privacy_combo, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (priv->ip6_addr_gen_mode_combo, "changed", G_CALLBACK (ce_page_changed),
self);
method_changed (priv->method, self);
g_signal_connect (priv->method, "changed", G_CALLBACK (method_changed), self);
@@ -1219,6 +1245,7 @@ ui_to_setting (CEPageIP6 *self, GError **error)
char **items = NULL, **iter;
gboolean may_fail;
NMSettingIP6ConfigPrivacy ip6_privacy;
+ NMSettingIP6ConfigAddrGenMode ip6_addr_gen_mode;
/* Method */
if (gtk_combo_box_get_active_iter (priv->method, &tree_iter)) {
@@ -1371,10 +1398,17 @@ ui_to_setting (CEPageIP6 *self, GError **error)
break;
}
+ /* IPv6 address generation mode */
+ if (gtk_combo_box_get_active (priv->ip6_addr_gen_mode_combo) == IP6_ADDR_GEN_MODE_EUI64)
+ ip6_addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64;
+ else
+ ip6_addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY;
+
may_fail = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->ip6_required));
g_object_set (G_OBJECT (priv->setting),
NM_SETTING_IP_CONFIG_MAY_FAIL, may_fail,
NM_SETTING_IP6_CONFIG_IP6_PRIVACY, ip6_privacy,
+ NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, ip6_addr_gen_mode,
NULL);
valid = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]