[network-manager-openvpn] handle 'tun-ipv6' option
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn] handle 'tun-ipv6' option
- Date: Mon, 15 Feb 2016 22:44:29 +0000 (UTC)
commit ffda527d8a932f2e3419d6c64623540e5b190d9e
Author: Anthony Bourguignon <contact+gnome toniob net>
Date: Fri Feb 12 11:09:42 2016 +0100
handle 'tun-ipv6' option
https://bugzilla.gnome.org/show_bug.cgi?id=761907
properties/auth-helpers.c | 11 +++++++++++
properties/import-export.c | 16 ++++++++++++++++
properties/nm-openvpn-dialog.ui | 21 ++++++++++++++++++++-
shared/nm-openvpn-service-defines.h | 1 +
src/nm-openvpn-service.c | 6 ++++++
5 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 465102c..6de346e 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -897,6 +897,7 @@ static const char *advanced_keys[] = {
NM_OPENVPN_KEY_RENEG_SECONDS,
NM_OPENVPN_KEY_TLS_REMOTE,
NM_OPENVPN_KEY_REMOTE_RANDOM,
+ NM_OPENVPN_KEY_TUN_IPV6,
NM_OPENVPN_KEY_REMOTE_CERT_TLS,
NM_OPENVPN_KEY_PING,
NM_OPENVPN_KEY_PING_EXIT,
@@ -1656,6 +1657,12 @@ advanced_dialog_new (GHashTable *hash, const char *contype)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
}
+ value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_TUN_IPV6);
+ if (value && !strcmp (value, "yes")) {
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "tun_ipv6_checkbutton"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ }
+
widget = GTK_WIDGET (gtk_builder_get_object (builder, "cipher_combo"));
value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_CIPHER);
populate_cipher_combo (GTK_COMBO_BOX (widget), value);
@@ -1980,6 +1987,10 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error)
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_REMOTE_RANDOM), g_strdup ("yes"));
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "tun_ipv6_checkbutton"));
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+ g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_TUN_IPV6), g_strdup ("yes"));
+
widget = GTK_WIDGET (gtk_builder_get_object (builder, "cipher_combo"));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)) {
diff --git a/properties/import-export.c b/properties/import-export.c
index 5b055da..093fa55 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -88,6 +88,7 @@
#define TAG_TLS_REMOTE "tls-remote"
#define TAG_TOPOLOGY "topology"
#define TAG_TUN_MTU "tun-mtu"
+#define TAG_TUN_IPV6 "tun-ipv6"
const char *_nmovpn_test_temp_path = NULL;
@@ -1008,6 +1009,13 @@ do_import (const char *path, const char *contents, gsize contents_len, GError **
continue;
}
+ if (_str_in_set (params[0], TAG_TUN_IPV6)) {
+ if (!args_params_check_nargs_n (params, 0, &line_error))
+ goto handle_line_error;
+ nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_TUN_IPV6, "yes");
+ continue;
+ }
+
if (_str_in_set (params[0], TAG_PORT, TAG_RPORT)) {
if (!args_params_check_nargs_n (params, 1, &line_error))
goto handle_line_error;
@@ -1465,6 +1473,7 @@ do_export (const char *path, NMConnection *connection, GError **error)
gboolean keysize_exists = FALSE;
guint32 keysize = 0;
gboolean randomize_hosts = FALSE;
+ gboolean tun_ipv6 = FALSE;
const char *proxy_type = NULL;
const char *proxy_server = NULL;
const char *proxy_port = NULL;
@@ -1619,6 +1628,10 @@ do_export (const char *path, NMConnection *connection, GError **error)
if (value && !strcmp (value, "yes"))
randomize_hosts = TRUE;
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_TUN_IPV6);
+ if (value && !strcmp (value, "yes"))
+ tun_ipv6 = TRUE;
+
/* Advanced values end */
fprintf (f, "client\n");
@@ -1653,6 +1666,9 @@ do_export (const char *path, NMConnection *connection, GError **error)
if (randomize_hosts)
fprintf (f, "remote-random\n");
+ if (tun_ipv6)
+ fprintf (f, "tun-ipv6\n");
+
/* Handle PKCS#12 (all certs are the same file) */
if ( cacert && user_cert && private_key
&& !strcmp (cacert, user_cert) && !strcmp (cacert, private_key))
diff --git a/properties/nm-openvpn-dialog.ui b/properties/nm-openvpn-dialog.ui
index a83c1f0..ba91610 100644
--- a/properties/nm-openvpn-dialog.ui
+++ b/properties/nm-openvpn-dialog.ui
@@ -1471,6 +1471,25 @@ config: remote-random</property>
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="tun_ipv6_checkbutton">
+ <property name="label" translatable="yes">IPv6 tun link</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Build a tun link capable of forwarding
IPv6 traffic
+config: tun-ipv6</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">9</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="float_checkbutton">
<property name="label" translatable="yes">Accept authenticated packets from any address
(F_loat)</property>
<property name="use_action_appearance">False</property>
@@ -1489,7 +1508,7 @@ config: float</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">9</property>
+ <property name="position">10</property>
</packing>
</child>
<child>
diff --git a/shared/nm-openvpn-service-defines.h b/shared/nm-openvpn-service-defines.h
index c963843..fd59dfe 100644
--- a/shared/nm-openvpn-service-defines.h
+++ b/shared/nm-openvpn-service-defines.h
@@ -63,6 +63,7 @@
#define NM_OPENVPN_KEY_TAP_DEV "tap-dev"
#define NM_OPENVPN_KEY_DEV "dev"
#define NM_OPENVPN_KEY_DEV_TYPE "dev-type"
+#define NM_OPENVPN_KEY_TUN_IPV6 "tun-ipv6"
#define NM_OPENVPN_KEY_TLS_REMOTE "tls-remote"
#define NM_OPENVPN_KEY_REMOTE_CERT_TLS "remote-cert-tls"
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 26182cb..812bd2b 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -138,6 +138,7 @@ static ValidProperty valid_properties[] = {
{ NM_OPENVPN_KEY_TAP_DEV, G_TYPE_BOOLEAN, 0, 0, FALSE },
{ NM_OPENVPN_KEY_DEV, G_TYPE_STRING, 0, 0, FALSE },
{ NM_OPENVPN_KEY_DEV_TYPE, G_TYPE_STRING, 0, 0, FALSE },
+ { NM_OPENVPN_KEY_TUN_IPV6, G_TYPE_STRING, 0, 0, FALSE },
{ NM_OPENVPN_KEY_TLS_REMOTE, G_TYPE_STRING, 0, 0, FALSE },
{ NM_OPENVPN_KEY_REMOTE_CERT_TLS, G_TYPE_STRING, 0, 0, FALSE },
{ NM_OPENVPN_KEY_TUNNEL_MTU, G_TYPE_INT, 0, G_MAXINT, FALSE },
@@ -1192,6 +1193,11 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin,
if (tmp && !strcmp (tmp, "yes"))
add_openvpn_arg (args, "--remote-random");
+ /* tun-ipv6 */
+ tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_TUN_IPV6);
+ if (tmp && !strcmp (tmp, "yes"))
+ add_openvpn_arg (args, "--tun-ipv6");
+
tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PROXY_TYPE);
tmp2 = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PROXY_SERVER);
tmp3 = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PROXY_PORT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]