[network-manager-openvpn] core: add support for tun-mtu, fragment, and mssfix (bgo #484315)



commit 96df84baa08011baa74b2a416450b884da8119e5
Author: Magnus Kulke <magnus kulke radicalapproach de>
Date:   Thu Feb 25 12:42:57 2010 -0800

    core: add support for tun-mtu, fragment, and mssfix (bgo #484315)
    
    (testcases and cleanups by dcbw)

 properties/auth-helpers.c             |  106 +++++++++++++++++++++++++++++++++
 properties/import-export.c            |   64 ++++++++++++++++++++
 properties/nm-openvpn-dialog.glade    |   90 ++++++++++++++++++++++++++++
 properties/tests/conf/Makefile.am     |    3 +-
 properties/tests/conf/tun-opts.conf   |   34 +++++++++++
 properties/tests/test-import-export.c |   66 ++++++++++++++++++++
 src/nm-openvpn-service.c              |   39 ++++++++++++
 src/nm-openvpn-service.h              |    3 +
 8 files changed, 404 insertions(+), 1 deletions(-)
---
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 9120385..7279550 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -755,6 +755,9 @@ sk_file_chooser_filter_new (void)
 static const char *advanced_keys[] = {
 	NM_OPENVPN_KEY_PORT,
 	NM_OPENVPN_KEY_COMP_LZO,
+	NM_OPENVPN_KEY_MSSFIX,
+	NM_OPENVPN_KEY_TUNNEL_MTU,
+	NM_OPENVPN_KEY_FRAGMENT_SIZE,
 	NM_OPENVPN_KEY_TAP_DEV,
 	NM_OPENVPN_KEY_PROTO_TCP,
 	NM_OPENVPN_KEY_CIPHER,
@@ -805,6 +808,26 @@ port_toggled_cb (GtkWidget *check, gpointer user_data)
 }
 
 static void
+tunmtu_toggled_cb (GtkWidget *check, gpointer user_data)
+{
+	GladeXML *xml = (GladeXML *) user_data;
+	GtkWidget *widget;
+
+	widget = glade_xml_get_widget (xml, "tunmtu_spinbutton");
+	gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+}
+
+static void
+fragment_toggled_cb (GtkWidget *check, gpointer user_data)
+{
+	GladeXML *xml = (GladeXML *) user_data;
+	GtkWidget *widget;
+
+	widget = glade_xml_get_widget (xml, "fragment_spinbutton");
+	gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+}
+
+static void
 reneg_toggled_cb (GtkWidget *check, gpointer user_data)
 {
 	GladeXML *xml = (GladeXML *) user_data;
@@ -1072,12 +1095,73 @@ advanced_dialog_new (GHashTable *hash, const char *contype)
 		gtk_widget_set_sensitive (widget, FALSE);
 	}
 
+	widget = glade_xml_get_widget (xml, "tunmtu_checkbutton");
+	g_assert (widget);
+	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (tunmtu_toggled_cb), xml);
+
+	value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_TUNNEL_MTU);
+	if (value && strlen (value)) {
+		long int tmp;
+
+		errno = 0;
+		tmp = strtol (value, NULL, 10);
+		if (errno == 0 && tmp > 0 && tmp < 65536) {
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+
+			widget = glade_xml_get_widget (xml, "tunmtu_spinbutton");
+			gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), (gdouble) tmp);
+			gtk_widget_set_sensitive (widget, TRUE);
+		}
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+
+		widget = glade_xml_get_widget (xml, "tunmtu_spinbutton");
+		gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), 1500.0);
+		gtk_widget_set_sensitive (widget, FALSE);
+	}
+
+	widget = glade_xml_get_widget (xml, "fragment_checkbutton");
+	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (fragment_toggled_cb), xml);
+
+	value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_FRAGMENT_SIZE);
+	if (value && strlen (value)) {
+		long int tmp;
+
+		errno = 0;
+		tmp = strtol (value, NULL, 10);
+		if (errno == 0 && tmp > 0 && tmp < 65536) {
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+
+			widget = glade_xml_get_widget (xml, "fragment_spinbutton");
+			gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), (gdouble) tmp);
+			gtk_widget_set_sensitive (widget, TRUE);
+		}
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+
+		widget = glade_xml_get_widget (xml, "fragment_spinbutton");
+		gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), 1300.0);
+		gtk_widget_set_sensitive (widget, FALSE);
+	}
+
+	value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_MSSFIX);
+	if (value && !strcmp (value, "yes")) {
+		widget = glade_xml_get_widget (xml, "mssfix_checkbutton");
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+	}
+
 	value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_COMP_LZO);
 	if (value && !strcmp (value, "yes")) {
 		widget = glade_xml_get_widget (xml, "lzo_checkbutton");
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
 	}
 
+	value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_MSSFIX);
+	if (value && !strcmp (value, "yes")) {
+		widget = glade_xml_get_widget (xml, "mssfix_checkbutton");
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+	}
+
 	value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_PROTO_TCP);
 	if (value && !strcmp (value, "yes")) {
 		widget = glade_xml_get_widget (xml, "tcp_checkbutton");
@@ -1188,6 +1272,24 @@ advanced_dialog_new_hash_from_dialog (GtkWidget *dialog, GError **error)
 		g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_RENEG_SECONDS), g_strdup_printf ("%d", reneg_seconds));
 	}
 
+	widget = glade_xml_get_widget (xml, "tunmtu_checkbutton");
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+		int tunmtu_size;
+
+		widget = glade_xml_get_widget (xml, "tunmtu_spinbutton");
+		tunmtu_size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+		g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_TUNNEL_MTU), g_strdup_printf ("%d", tunmtu_size));
+	}
+
+	widget = glade_xml_get_widget (xml, "fragment_checkbutton");
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+		int fragment_size;
+
+		widget = glade_xml_get_widget (xml, "fragment_spinbutton");
+		fragment_size = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+		g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_FRAGMENT_SIZE), g_strdup_printf ("%d", fragment_size));
+	}
+
 	widget = glade_xml_get_widget (xml, "port_checkbutton");
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
 		int port;
@@ -1201,6 +1303,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_COMP_LZO), g_strdup ("yes"));
 
+	widget = glade_xml_get_widget (xml, "mssfix_checkbutton");
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+		g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_MSSFIX), g_strdup ("yes"));
+
 	widget = glade_xml_get_widget (xml, "tcp_checkbutton");
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
 		g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_PROTO_TCP), g_strdup ("yes"));
diff --git a/properties/import-export.c b/properties/import-export.c
index d5df3ec..d109b9a 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -62,6 +62,9 @@
 #define TLS_REMOTE_TAG "tls-remote"
 #define PORT_TAG "port"
 #define RPORT_TAG "rport"
+#define MSSFIX_TAG "mssfix"
+#define TUNMTU_TAG "tun-mtu"
+#define FRAGMENT_TAG "fragment"
 
 
 static char *
@@ -262,6 +265,53 @@ do_import (const char *path, char **lines, GError **error)
 			continue;
 		}
 
+		if (!strncmp (*line, MSSFIX_TAG, strlen (MSSFIX_TAG))) {
+			nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_MSSFIX, "yes");
+			continue;
+		}
+
+		if (!strncmp (*line, TUNMTU_TAG, strlen (TUNMTU_TAG))) {
+			items = get_args (*line + strlen (TUNMTU_TAG));
+			if (!items)
+				continue;
+
+			if (g_strv_length (items) >= 1) {
+				glong secs;
+
+				errno = 0;
+				secs = strtol (items[0], NULL, 10);
+				if ((errno == 0) && (secs >= 0) && (secs < 0xffff)) {
+					char *tmp = g_strdup_printf ("%d", (guint32) secs);
+					nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_TUNNEL_MTU, tmp);
+					g_free (tmp);
+				} else
+					g_warning ("%s: invalid size in option '%s'", __func__, *line);
+			}
+			g_strfreev (items);
+			continue;
+		}
+
+		if (!strncmp (*line, FRAGMENT_TAG, strlen (FRAGMENT_TAG))) {
+			items = get_args (*line + strlen (FRAGMENT_TAG));
+			if (!items)
+				continue;
+
+			if (g_strv_length (items) >= 1) {
+				glong secs;
+
+				errno = 0;
+				secs = strtol (items[0], NULL, 10);
+				if ((errno == 0) && (secs >= 0) && (secs < 0xffff)) {
+					char *tmp = g_strdup_printf ("%d", (guint32) secs);
+					nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_FRAGMENT_SIZE, tmp);
+					g_free (tmp);
+				} else
+					g_warning ("%s: invalid size in option '%s'", __func__, *line);
+			}
+			g_strfreev (items);
+			continue;
+		}
+
 		if (!strncmp (*line, COMP_TAG, strlen (COMP_TAG))) {
 			nm_setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "yes");
 			continue;
@@ -642,6 +692,20 @@ do_export (const char *path, NMConnection *connection, GError **error)
 	if (use_lzo)
 		fprintf (f, "comp-lzo yes\n");
 
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_MSSFIX);
+	if (value && strlen (value)) {
+		if (!strcmp (value, "yes"))
+			fprintf (f, MSSFIX_TAG "\n");
+	}
+
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_TUNNEL_MTU);
+	if (value && strlen (value))
+		fprintf (f, TUNMTU_TAG " %d\n", (int) strtol (value, NULL, 10));
+
+	value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_FRAGMENT_SIZE);
+	if (value && strlen (value))
+		fprintf (f, FRAGMENT_TAG " %d\n", (int) strtol (value, NULL, 10));
+
 	fprintf (f, "dev %s\n", device_tun ? "tun" : "tap");
 	fprintf (f, "proto %s\n", proto_udp ? "udp" : "tcp");
 
diff --git a/properties/nm-openvpn-dialog.glade b/properties/nm-openvpn-dialog.glade
index 6c36073..dc476b2 100644
--- a/properties/nm-openvpn-dialog.glade
+++ b/properties/nm-openvpn-dialog.glade
@@ -1015,6 +1015,96 @@
                     <property name="position">4</property>
                   </packing>
                 </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox4">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkCheckButton" id="tunmtu_checkbutton">
+                        <property name="label" translatable="yes">Use custom _tunnel Maximum Transmission Unit (MTU):</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkSpinButton" id="tunmtu_spinbutton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                        <property name="adjustment">1500 1 65535 1 10 10</property>
+                        <property name="climb_rate">1</property>
+                        <property name="numeric">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">5</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox5">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkCheckButton" id="fragment_checkbutton">
+                        <property name="label" translatable="yes">Use custom UDP _fragment size:</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkSpinButton" id="fragment_spinbutton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                        <property name="adjustment">1300 1 65535 1 10 10</property>
+                        <property name="climb_rate">1</property>
+                        <property name="numeric">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">6</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkCheckButton" id="mssfix_checkbutton">
+                    <property name="label" translatable="yes">Restrict tunnel TCP Maximum Segment Size (MSS)</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">7</property>
+                  </packing>
+                </child>
               </widget>
             </child>
             <child>
diff --git a/properties/tests/conf/Makefile.am b/properties/tests/conf/Makefile.am
index 9512a3e..f999b76 100644
--- a/properties/tests/conf/Makefile.am
+++ b/properties/tests/conf/Makefile.am
@@ -5,6 +5,7 @@ EXTRA_DIST = \
 	static.key \
 	static.ovpn \
 	port.ovpn \
-	rport.ovpn
+	rport.ovpn \
+	tun-opts.conf
 
 
diff --git a/properties/tests/conf/tun-opts.conf b/properties/tests/conf/tun-opts.conf
new file mode 100644
index 0000000..b7d3180
--- /dev/null
+++ b/properties/tests/conf/tun-opts.conf
@@ -0,0 +1,34 @@
+client
+dev tun
+
+proto udp
+topology subnet
+
+tun-mtu 1300
+mssfix
+fragment 1200
+
+rport 2352
+remote test.server.com 443
+nobind
+persist-key
+persist-tun
+user openvpn
+group openvpn
+
+
+ca cacert.pem
+cipher AES-256-CBC
+reneg-sec 0
+
+auth-user-pass
+auth-nocache
+
+ping 30
+ping-exit 120
+
+# random comment
+
+script-security 2
+
+
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 119db71..c1fcbcb 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -575,6 +575,69 @@ test_port_export (NMVpnPluginUiInterface *plugin,
 	g_free (path);
 }
 
+static void
+test_tun_opts_import (NMVpnPluginUiInterface *plugin, const char *dir)
+{
+	NMConnection *connection;
+	NMSettingVPN *s_vpn;
+
+	connection = get_basic_connection ("tunopts-import", plugin, dir, "tun-opts.conf");
+	ASSERT (connection != NULL, "tunopts-import", "failed to import connection");
+
+	/* VPN setting */
+	s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
+	ASSERT (s_vpn != NULL,
+	        "tunopts-import", "missing 'vpn' setting");
+
+	/* Data items */
+	test_item ("tunopts-import-data", s_vpn, NM_OPENVPN_KEY_MSSFIX, "yes");
+	test_item ("tunopts-import-data", s_vpn, NM_OPENVPN_KEY_TUNNEL_MTU, "1300");
+	test_item ("tunopts-import-data", s_vpn, NM_OPENVPN_KEY_FRAGMENT_SIZE, "1200");
+
+	g_object_unref (connection);
+}
+
+#define TUNOPTS_EXPORTED_NAME "tun-opts.ovpntest"
+static void
+test_tun_opts_export (NMVpnPluginUiInterface *plugin, const char *dir)
+{
+	NMConnection *connection;
+	NMConnection *reimported;
+	char *path;
+	gboolean success;
+	GError *error = NULL;
+	int ret;
+
+	connection = get_basic_connection ("tunopts-export", plugin, dir, "tun-opts.conf");
+	ASSERT (connection != NULL, "tunopts-export", "failed to import connection");
+
+	path = g_build_path ("/", dir, TUNOPTS_EXPORTED_NAME, NULL);
+	success = nm_vpn_plugin_ui_interface_export (plugin, path, connection, &error);
+	if (!success) {
+		if (!error)
+			FAIL ("tunopts-export", "export failed with missing error");
+		else
+			FAIL ("tunopts-export", "export failed: %s", error->message);
+	}
+
+	/* Now re-import it and compare the connections to ensure they are the same */
+	reimported = get_basic_connection ("tunopts-export", plugin, dir, TUNOPTS_EXPORTED_NAME);
+	ret = unlink (path);
+	ASSERT (connection != NULL, "tunopts-export", "failed to re-import connection");
+
+	/* Clear secrets first, since they don't get exported, and thus would
+	 * make the connection comparison below fail.
+	 */
+	remove_secrets (connection);
+
+	ASSERT (nm_connection_compare (connection, reimported, NM_SETTING_COMPARE_FLAG_EXACT) == TRUE,
+	        "tunopts-export", "original and reimported connection differ");
+
+	g_object_unref (reimported);
+	g_object_unref (connection);
+	g_free (path);
+}
+
 int main (int argc, char **argv)
 {
 	GError *error = NULL;
@@ -615,6 +678,9 @@ int main (int argc, char **argv)
 	test_port_import (plugin, "rport-import", argv[1], "rport.ovpn", "rport", "6789");
 	test_port_export (plugin, "rport-export", argv[1], "rport.ovpn", "rport.ovpntest");
 
+	test_tun_opts_import (plugin, argv[1]);
+	test_tun_opts_export (plugin, argv[1]);
+
 	g_object_unref (plugin);
 
 	basename = g_path_get_basename (argv[0]);
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 7405322..920abcb 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -88,6 +88,9 @@ static ValidProperty valid_properties[] = {
 	{ NM_OPENVPN_KEY_CERT,                 G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_CIPHER,               G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_COMP_LZO,             G_TYPE_BOOLEAN, 0, 0, FALSE },
+	{ NM_OPENVPN_KEY_MSSFIX,               G_TYPE_BOOLEAN, 0, 0, FALSE },
+	{ NM_OPENVPN_KEY_TUNNEL_MTU,           G_TYPE_INT, 0, G_MAXINT, FALSE },
+	{ NM_OPENVPN_KEY_FRAGMENT_SIZE,        G_TYPE_INT, 0, G_MAXINT, FALSE },
 	{ NM_OPENVPN_KEY_CONNECTION_TYPE,      G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_TAP_DEV,              G_TYPE_BOOLEAN, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_KEY,                  G_TYPE_STRING, 0, 0, FALSE },
@@ -778,6 +781,42 @@ nm_openvpn_start_openvpn_binary (NMOpenvpnPlugin *plugin,
 		add_openvpn_arg (args, "nm-openvpn");
 	}
 
+	/* TUN MTU size */
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_TUNNEL_MTU);
+	if (tmp && strlen (tmp)) {
+		add_openvpn_arg (args, "--tun-mtu");
+		if (!add_openvpn_arg_int (args, tmp)) {
+			g_set_error (error,
+			             NM_VPN_PLUGIN_ERROR,
+			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+			             "Invalid TUN MTU size '%s'.",
+			             tmp);
+			free_openvpn_args (args);
+			return FALSE;
+		}
+	}
+
+	/* fragment size */
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_FRAGMENT_SIZE);
+	if (tmp && strlen (tmp)) {
+		add_openvpn_arg (args, "--fragment");
+		if (!add_openvpn_arg_int (args, tmp)) {
+			g_set_error (error,
+			             NM_VPN_PLUGIN_ERROR,
+			             NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,
+			             "Invalid fragment size '%s'.",
+			             tmp);
+			free_openvpn_args (args);
+			return FALSE;
+		}
+	}
+
+	/* mssfix */
+	tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_MSSFIX);
+	if (tmp && !strcmp (tmp, "yes")) {
+		add_openvpn_arg (args, "--mssfix");
+	}
+
 	/* Punch script security in the face; this option was added to OpenVPN 2.1-rc9
 	 * and defaults to disallowing any scripts, a behavior change from previous
 	 * versions.
diff --git a/src/nm-openvpn-service.h b/src/nm-openvpn-service.h
index bd50d4f..b8dcb3e 100644
--- a/src/nm-openvpn-service.h
+++ b/src/nm-openvpn-service.h
@@ -43,6 +43,9 @@
 #define NM_OPENVPN_KEY_CERT "cert"
 #define NM_OPENVPN_KEY_CIPHER "cipher"
 #define NM_OPENVPN_KEY_COMP_LZO "comp-lzo"
+#define NM_OPENVPN_KEY_MSSFIX "mssfix"
+#define NM_OPENVPN_KEY_TUNNEL_MTU "tunnel-mtu"
+#define NM_OPENVPN_KEY_FRAGMENT_SIZE "fragment-size"
 #define NM_OPENVPN_KEY_CONNECTION_TYPE "connection-type"
 #define NM_OPENVPN_KEY_TAP_DEV "tap-dev"
 #define NM_OPENVPN_KEY_KEY "key"



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