[From nobody Tue Nov 24 12:24:10 2026
Received: (at submit) by bugs.debian.org; 5 Feb 2014 02:31:12 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2-bugs.debian.org_2005_01_02
 (2011-06-06) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-8.9 required=4.0 tests=BAYES_00, FOURLA, HAS_PACKAGE,
 T_RP_MATCHES_RCVD,WORD_WITHOUT_VOWELS autolearn=ham
 version=3.3.2-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 53; hammy, 151; neutral, 159; spammy,
 0. spammytokens: hammytokens:0.000-+--networkmanager,
 0.000-+--H*u:1.5.21, 
 0.000-+--H*UA:1.5.21, 0.000-+--H*u:2010-09-15, 0.000-+--H*UA:2010-09-15
Return-path: &lt;sourceforge@anomie.yi.org&gt;
Received: from anomie.yi.org ([198.58.115.59])
 by buxtehude.debian.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128)
 (Exim 4.80) (envelope-from &lt;sourceforge@anomie.yi.org&gt;)
 id 1WAsGe-0004W1-8E
 for submit@bugs.debian.org; Wed, 05 Feb 2014 02:31:12 +0000
Received: from sourceforge by anomie.yi.org with local (Exim 4.80)
 (envelope-from &lt;sourceforge@anomie.yi.org&gt;) id 1WAsGd-0004lD-Fs
 for submit@bugs.debian.org; Tue, 04 Feb 2014 21:31:11 -0500
Date: Tue, 4 Feb 2014 21:31:11 -0500
From: anomie@users.sourceforge.net
To: submit@bugs.debian.org
Subject: Should support &quot;Interface name&quot;
Message-ID: &lt;20140205023111.GE18181@anomie.yi.org&gt;
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=&quot;Fba/0zbH8Xs+Fj9o&quot;
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
User-Agent: Mutt/1.5.21 (2010-09-15)
Delivered-To: submit@bugs.debian.org


--Fba/0zbH8Xs+Fj9o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Package: network-manager-vpnc
Version: 0.9.8.6-1

For firewall rules, it would be nice if the VPN interface could be
configured to have a predictable name instead of generic &quot;tun0&quot;.

It turns out vpnc already supports this, we just need to expose the
option in NetworkManager.

--Fba/0zbH8Xs+Fj9o
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=InterfaceName
Content-Transfer-Encoding: 8bit

diff -urN a/properties/nm-vpnc.c b/properties/nm-vpnc.c
--- a/properties/nm-vpnc.c	2013-09-13 12:01:23.000000000 -0400
+++ b/properties/nm-vpnc.c	2014-02-04 18:21:47.714491746 -0500
@@ -702,6 +702,16 @@
 	}
 	g_signal_connect (G_OBJECT (widget), &quot;changed&quot;, G_CALLBACK (spinbutton_changed_cb), self);
 
+	widget = GTK_WIDGET (gtk_builder_get_object (priv-&gt;builder, &quot;interface_name_entry&quot;));
+	g_return_val_if_fail (widget != NULL, FALSE);
+	gtk_size_group_add_widget (priv-&gt;group, GTK_WIDGET (widget));
+	if (s_vpn) {
+		value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_INTERFACE_NAME);
+		if (value &amp;&amp; strlen (value))
+			gtk_entry_set_text (GTK_ENTRY (widget), value);
+	}
+	g_signal_connect (G_OBJECT (widget), &quot;changed&quot;, G_CALLBACK (stuff_changed_cb), self);
+
 	widget = GTK_WIDGET (gtk_builder_get_object (priv-&gt;builder, &quot;disable_dpd_checkbutton&quot;));
 	g_return_val_if_fail (widget != NULL, FALSE);
 	if (s_vpn) {
@@ -992,6 +1002,11 @@
 	port = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
 	nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_LOCAL_PORT, g_strdup_printf (&quot;%d&quot;, port));
 
+	widget = GTK_WIDGET (gtk_builder_get_object (priv-&gt;builder, &quot;interface_name_entry&quot;));
+	str = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+	if (str &amp;&amp; strlen (str))
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_INTERFACE_NAME, str);
+
 	widget = GTK_WIDGET (gtk_builder_get_object (priv-&gt;builder, &quot;disable_dpd_checkbutton&quot;));
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
 		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_DPD_IDLE_TIMEOUT, &quot;0&quot;);
@@ -1540,6 +1555,12 @@
 		g_free (tmp);
 	}
 
+	buf = key_file_get_string_helper (keyfile, &quot;main&quot;, &quot;InterfaceName&quot;, NULL);
+	if (buf) {
+		nm_setting_vpn_add_data_item (s_vpn, NM_VPNC_KEY_INTERFACE_NAME, buf);
+		g_free (buf);
+	}
+
 	g_key_file_free (keyfile);
 	return connection;
 
@@ -1572,6 +1593,7 @@
 	const char *group_pw = NULL;
 	GString *routes = NULL;
 	GString *uselegacyikeport = NULL;
+	const char *interfacename = NULL;
 	gboolean success = FALSE;
 	guint32 routes_count = 0;
 	gboolean save_password = FALSE;
@@ -1697,6 +1719,10 @@
 	if (!value || !strcmp (value, &quot;0&quot;))
 		g_string_assign (uselegacyikeport, &quot;UseLegacyIKEPort=0\n&quot;);
 
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_VPNC_KEY_INTERFACE_NAME);
+	if (value &amp;&amp; strlen (value))
+		interfacename = value;
+
 	fprintf (f, 
 		 &quot;[main]\n&quot;
 		 &quot;Description=%s\n&quot;
@@ -1736,6 +1762,7 @@
 		 &quot;SingleDES=%s\n&quot;
 		 &quot;SPPhonebook=\n&quot;
 		 &quot;%s&quot;
+                 &quot;InterfaceName=%s\n&quot;
 		 &quot;X-NM-Use-NAT-T=%s\n&quot;
 		 &quot;X-NM-Force-NAT-T=%s\n&quot;
 		 &quot;X-NM-SaveGroupPassword=%s\n&quot;
@@ -1752,6 +1779,7 @@
 		 /* PeerTimeout */   peertimeout != NULL ? peertimeout : &quot;0&quot;,
 		 /* SingleDES */     singledes ? &quot;1&quot; : &quot;0&quot;,
 		 /* UseLegacyIKEPort */ (uselegacyikeport-&gt;len) ? uselegacyikeport-&gt;str : &quot;&quot;,
+		 /* InterfaceName */ interfacename != NULL ? interfacename : &quot;&quot;,
 		 /* X-NM-Use-NAT-T */ use_natt ? &quot;1&quot; : &quot;0&quot;,
 		 /* X-NM-Force-NAT-T */ use_force_natt ? &quot;1&quot; : &quot;0&quot;,
 		 /* X-NM-SaveGroupPassword */ save_group_password ? &quot;1&quot; : &quot;0&quot;,
diff -urN a/properties/nm-vpnc-dialog.ui b/properties/nm-vpnc-dialog.ui
--- a/properties/nm-vpnc-dialog.ui	2013-02-18 18:08:36.000000000 -0500
+++ b/properties/nm-vpnc-dialog.ui	2014-02-04 18:16:39.050497185 -0500
@@ -477,6 +477,36 @@
                       &lt;/packing&gt;
                     &lt;/child&gt;
                     &lt;child&gt;
+                      &lt;object class=&quot;GtkLabel&quot; id=&quot;interface_name_label&quot;&gt;
+                        &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
+                        &lt;property name=&quot;can_focus&quot;&gt;False&lt;/property&gt;
+                        &lt;property name=&quot;xalign&quot;&gt;0&lt;/property&gt;
+                        &lt;property name=&quot;label&quot; translatable=&quot;yes&quot;&gt;Interface name:&lt;/property&gt;
+                        &lt;property name=&quot;use_underline&quot;&gt;True&lt;/property&gt;
+                        &lt;property name=&quot;mnemonic_widget&quot;&gt;interface_name_entry&lt;/property&gt;
+                      &lt;/object&gt;
+                      &lt;packing&gt;
+                        &lt;property name=&quot;top_attach&quot;&gt;5&lt;/property&gt;
+                        &lt;property name=&quot;bottom_attach&quot;&gt;6&lt;/property&gt;
+                      &lt;/packing&gt;
+                    &lt;/child&gt;
+                    &lt;child&gt;
+                      &lt;object class=&quot;GtkEntry&quot; id=&quot;interface_name_entry&quot;&gt;
+                        &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
+                        &lt;property name=&quot;can_focus&quot;&gt;True&lt;/property&gt;
+                        &lt;property name=&quot;invisible_char&quot;&gt;•&lt;/property&gt;
+                        &lt;property name=&quot;invisible_char_set&quot;&gt;True&lt;/property&gt;
+                        &lt;property name=&quot;tooltip_text&quot; translatable=&quot;yes&quot;&gt;Visible name of the TUN/TAP interface
+config: Interface name &lt;ASCII string&gt;&lt;/property&gt;
+                      &lt;/object&gt;
+                      &lt;packing&gt;
+                        &lt;property name=&quot;left_attach&quot;&gt;1&lt;/property&gt;
+                        &lt;property name=&quot;right_attach&quot;&gt;2&lt;/property&gt;
+                        &lt;property name=&quot;top_attach&quot;&gt;5&lt;/property&gt;
+                        &lt;property name=&quot;bottom_attach&quot;&gt;6&lt;/property&gt;
+                      &lt;/packing&gt;
+                    &lt;/child&gt;
+                    &lt;child&gt;
                       &lt;object class=&quot;GtkCheckButton&quot; id=&quot;disable_dpd_checkbutton&quot;&gt;
                         &lt;property name=&quot;label&quot; translatable=&quot;yes&quot;&gt;Disable Dead _Peer Detection&lt;/property&gt;
                         &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
diff -urN a/src/nm-vpnc-service.c b/src/nm-vpnc-service.c
--- a/src/nm-vpnc-service.c	2013-09-13 12:07:19.000000000 -0400
+++ b/src/nm-vpnc-service.c	2014-02-04 18:17:40.494496102 -0500
@@ -97,6 +97,7 @@
 	{ NM_VPNC_KEY_NAT_TRAVERSAL_MODE,    ITEM_TYPE_STRING, 0, 0 },
 	{ NM_VPNC_KEY_CISCO_UDP_ENCAPS_PORT, ITEM_TYPE_INT, 0, 65535 },
 	{ NM_VPNC_KEY_LOCAL_PORT,            ITEM_TYPE_INT, 0, 65535 },
+	{ NM_VPNC_KEY_INTERFACE_NAME,        ITEM_TYPE_STRING, 0, 0 },
 	/* Hybrid Auth */
 	{ NM_VPNC_KEY_AUTHMODE,              ITEM_TYPE_STRING, 0, 0 },
 	{ NM_VPNC_KEY_CA_FILE,               ITEM_TYPE_PATH, 0, 0 },
diff -urN a/src/nm-vpnc-service.h b/src/nm-vpnc-service.h
--- a/src/nm-vpnc-service.h	2013-02-18 18:08:36.000000000 -0500
+++ b/src/nm-vpnc-service.h	2014-02-04 18:17:23.902496395 -0500
@@ -55,6 +55,7 @@
 #define NM_VPNC_KEY_DPD_IDLE_TIMEOUT &quot;DPD idle timeout (our side)&quot;
 #define NM_VPNC_KEY_CISCO_UDP_ENCAPS_PORT &quot;Cisco UDP Encapsulation Port&quot;
 #define NM_VPNC_KEY_LOCAL_PORT &quot;Local Port&quot;
+#define NM_VPNC_KEY_INTERFACE_NAME &quot;Interface name&quot;
 #define NM_VPNC_KEY_AUTHMODE &quot;IKE Authmode&quot;
 #define NM_VPNC_KEY_CA_FILE &quot;CA-File&quot;
 

--Fba/0zbH8Xs+Fj9o--
]