File compress.patch of Package NetworkManager-openvpn
diff -X exclude.txt -uNr a/auth-dialog/main.c b/auth-dialog/main.c
--- a/auth-dialog/main.c 2019-02-08 17:02:44.000000000 +0100
+++ b/auth-dialog/main.c 2019-08-16 10:56:25.959949795 +0200
@@ -1,5 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
+/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* Dan Williams <dcbw@redhat.com>
* Tim Niemueller <tim@niemueller.de>
@@ -18,8 +18,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2004 - 2008 Red Hat, Inc.
- * 2005 Tim Niemueller [www.niemueller.de]
+ * Copyright (C) 2005 Tim Niemueller [www.niemueller.de]
+ * Copyright (C) 2004 - 2018 Red Hat, Inc.
*/
#include "nm-default.h"
diff -X exclude.txt -uNr a/Makefile.am b/Makefile.am
--- a/Makefile.am 2019-02-08 17:02:44.000000000 +0100
+++ b/Makefile.am 2019-08-16 10:56:25.959949795 +0200
@@ -285,6 +285,7 @@
EXTRA_DIST += \
+ properties/tests/conf/compress.ovpn \
properties/tests/conf/iso885915.ovpn \
properties/tests/conf/mtu-disc.ovpn \
properties/tests/conf/password.conf \
diff -X exclude.txt -uNr a/po/sk.po b/po/sk.po
--- a/po/sk.po 2019-02-08 17:02:44.000000000 +0100
+++ b/po/sk.po 2019-08-16 10:56:25.959949795 +0200
@@ -3,8 +3,6 @@
# This file is distributed under the same license as the NetworkManager package.
# Marcel Telka <marcel@telka.sk>, 2004, 2005, 2006.
#
-# $Id: sk.po,v 1.1 2006/06/17 20:55:49 marcel Exp $
-#
msgid ""
msgstr ""
"Project-Id-Version: NetworkManager-openvpn\n"
diff -X exclude.txt -uNr a/properties/import-export.c b/properties/import-export.c
--- a/properties/import-export.c 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/import-export.c 2019-08-16 10:56:25.959949795 +0200
@@ -1,5 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/***************************************************************************
+/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,9 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2008 - 2013 Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
- *
- **************************************************************************/
+ * Copyright (C) 2008 - 2013 Dan Williams <dcbw@redhat.com>
+ * Copyright (C) 2008 - 2018 Red Hat, Inc.
+ */
#include "nm-default.h"
@@ -1018,6 +1018,19 @@
continue;
}
+ if (NM_IN_STRSET (params[0], NMV_OVPN_TAG_COMPRESS)) {
+ if (!args_params_check_nargs_minmax (params, 0, 1, &line_error))
+ goto handle_line_error;
+ if (params[1]) {
+ if (!args_params_check_arg_utf8 (params, 1, NULL, &line_error))
+ goto handle_line_error;
+ setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, params[1]);
+ } else {
+ setting_vpn_add_data_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "yes");
+ }
+ continue;
+ }
+
if (NM_IN_STRSET (params[0], NMV_OVPN_TAG_FLOAT)) {
if (!args_params_check_nargs_n (params, 0, &line_error))
goto handle_line_error;
@@ -1956,6 +1969,12 @@
args_write_line (f, NMV_OVPN_TAG_COMP_LZO, value);
}
+ value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_COMPRESS);
+ if (nm_streq0 (value, "yes"))
+ args_write_line (f, NMV_OVPN_TAG_COMPRESS);
+ else if (value)
+ args_write_line_setting_value (f, NMV_OVPN_TAG_COMPRESS, s_vpn, NM_OPENVPN_KEY_COMPRESS);
+
if (nm_streq0 (nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_FLOAT), "yes"))
args_write_line (f, NMV_OVPN_TAG_FLOAT);
diff -X exclude.txt -uNr a/properties/import-export.h b/properties/import-export.h
--- a/properties/import-export.h 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/import-export.h 2019-08-16 10:56:25.959949795 +0200
@@ -1,7 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/***************************************************************************
- *
- * Copyright (C) 2008 Dan Williams, <dcbw@redhat.com>
+/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,7 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- **************************************************************************/
+ * Copyright (C) 2008 Dan Williams, <dcbw@redhat.com>
+ * Copyright (C) 2008 - 2018 Red Hat, Inc.
+ */
#ifndef _IMPORT_EXPORT_H_
#define _IMPORT_EXPORT_H_
diff -X exclude.txt -uNr a/properties/nm-openvpn-dialog.ui b/properties/nm-openvpn-dialog.ui
--- a/properties/nm-openvpn-dialog.ui 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/nm-openvpn-dialog.ui 2019-08-16 10:56:25.959949795 +0200
@@ -64,6 +64,33 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkListStore" id="compression">
+ <columns>
+ <!-- column-name value -->
+ <column type="gchararray"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0">yes</col>
+ <col id="1" translatable="yes">Automatic</col>
+ </row>
+ <row>
+ <col id="0">lz4</col>
+ <col id="1" translatable="yes">LZ4</col>
+ </row>
+ <row>
+ <col id="0">lzo</col>
+ <col id="1" translatable="yes">LZO</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkEntryCompletion" id="compress_completion">
+ <property name="model">compression</property>
+ <property name="minimum_key_length">0</property>
+ <property name="text_column">0</property>
+ </object>
<object class="GtkListStore" id="liststore1"/>
<object class="GtkListStore" id="liststore2"/>
<object class="GtkListStore" id="model1">
@@ -910,6 +937,7 @@
<property name="border_width">12</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
+ <property name="homogeneous">True</property>
<child>
<object class="GtkBox" id="hbox1">
<property name="visible">True</property>
@@ -1010,8 +1038,8 @@
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkCheckButton" id="lzo_checkbutton">
- <property name="label" translatable="yes">Use L_ZO data compression</property>
+ <object class="GtkCheckButton" id="compress_checkbutton">
+ <property name="label" translatable="yes">Data _compression:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1029,23 +1057,23 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="lzo_combo">
+ <object class="GtkComboBox" id="compress_combo">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Select the LZO data compression mode.
-config: comp-lzo</property>
- <property name="model">model4</property>
- <child>
- <object class="GtkCellRendererText" id="renderer13"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <property name="can_focus">False</property>
+ <property name="model">compression</property>
+ <property name="has_entry">True</property>
+ <property name="entry_text_column">1</property>
+ <property name="id_column">0</property>
+ <child internal-child="entry">
+ <object class="GtkEntry" id="compress_entry">
+ <property name="can_focus">True</property>
+ </object>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff -X exclude.txt -uNr a/properties/nm-openvpn-editor.c b/properties/nm-openvpn-editor.c
--- a/properties/nm-openvpn-editor.c 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/nm-openvpn-editor.c 2019-08-16 11:05:13.945319807 +0200
@@ -1,14 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/***************************************************************************
- * CVSID: $Id: nm-openvpn.c 4232 2008-10-29 09:13:40Z tambeti $
- *
- * nm-openvpn.c : GNOME UI dialogs for configuring openvpn VPN connections
- *
- * Copyright (C) 2005 Tim Niemueller <tim@niemueller.de>
- * Copyright (C) 2008 Tambet Ingo, <tambet@gmail.com>
- * Copyright (C) 2008 - 2010 Dan Williams, <dcbw@redhat.com>
- * Copyright (C) 2008 - 2017 Red Hat, Inc.
- * Based on work by David Zeuthen, <davidz@redhat.com>
+/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +15,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- **************************************************************************/
+ * Based on work by David Zeuthen, <davidz@redhat.com>
+ * Copyright (C) 2005 Tim Niemueller <tim@niemueller.de>
+ * Copyright (C) 2008 Tambet Ingo, <tambet@gmail.com>
+ * Copyright (C) 2008 - 2010 Dan Williams, <dcbw@redhat.com>
+ * Copyright (C) 2008 - 2017 Red Hat, Inc.
+ */
#include "nm-default.h"
@@ -56,38 +52,6 @@
/*****************************************************************************/
-static const char *comp_lzo_values[] = {
- "adaptive",
- "yes",
- "no-by-default",
-};
-
-static const char *
-comp_lzo_values_conf_coerce (const char *value_conf)
-{
- if (!value_conf || nm_streq (value_conf, "no"))
- return NULL;
- if (nm_streq (value_conf, "yes"))
- return "yes";
- if (nm_streq (value_conf, "no-by-default"))
- return "no-by-default";
- return "adaptive";
-}
-
-static const char *
-comp_lzo_values_conf_to_display (const char *value_conf)
-{
- if (nm_streq (value_conf, "yes"))
- return "yes";
- if (nm_streq (value_conf, "no-by-default"))
- return "no";
- if (nm_streq (value_conf, "adaptive"))
- return "adaptive";
- g_return_val_if_reached ("adaptive");
-}
-
-/*****************************************************************************/
-
/* From gnome-control-center/panels/network/connection-editor/ui-helpers.c */
static void
@@ -684,7 +648,7 @@
static const char *const advanced_keys[] = {
NM_OPENVPN_KEY_AUTH,
NM_OPENVPN_KEY_CIPHER,
- NM_OPENVPN_KEY_COMP_LZO,
+ NM_OPENVPN_KEY_COMPRESS,
NM_OPENVPN_KEY_CONNECT_TIMEOUT,
NM_OPENVPN_KEY_CRL_VERIFY_DIR,
NM_OPENVPN_KEY_CRL_VERIFY_FILE,
@@ -1463,7 +1427,6 @@
GtkListStore *store;
GtkTreeIter iter;
int vint;
- guint i;
guint32 active;
NMSettingSecretFlags pw_flags;
GError *error = NULL;
@@ -1584,24 +1547,25 @@
_builder_init_optional_spinbutton (builder, "fragment_checkbutton", "fragment_spinbutton", !!value,
_nm_utils_ascii_str_to_int64 (value, 10, 0, 65535, 1300));
-
- value = comp_lzo_values_conf_coerce (g_hash_table_lookup (hash, NM_OPENVPN_KEY_COMP_LZO));
- widget = GTK_WIDGET (_builder_init_toggle_button (builder, "lzo_checkbutton", value != NULL));
- combo = GTK_WIDGET (gtk_builder_get_object (builder, "lzo_combo"));
- store = gtk_list_store_new (1, G_TYPE_STRING);
- active = 0;
- for (i = 0; i < G_N_ELEMENTS (comp_lzo_values); i++) {
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- 0, comp_lzo_values_conf_to_display (comp_lzo_values[i]),
- -1);
- if (nm_streq (comp_lzo_values[i], value ?: "adaptive"))
- active = i;
+ value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_COMPRESS);
+ if (!value) {
+ /* Migrate from the legacy comp-lzo option */
+ value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_COMP_LZO);
+ if (g_strcmp0 (value, "yes") == 0)
+ value = "lzo";
+ else if (g_strcmp0 (value, "no-by-default") == 0)
+ value = "no";
+ else if (g_strcmp0 (value, "adaptive") == 0)
+ value = "yes";
}
- gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
- g_object_unref (store);
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), active);
+ combo = GTK_WIDGET (gtk_builder_get_object (builder, "compress_combo"));
+ widget = GTK_WIDGET (_builder_init_toggle_button (builder, "compress_checkbutton", value != NULL));
g_object_bind_property (widget, "active", combo, "sensitive", G_BINDING_SYNC_CREATE);
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (combo), "yes");
+ if (!gtk_combo_box_set_active_id (GTK_COMBO_BOX (combo), value)) {
+ entry = GTK_WIDGET (gtk_builder_get_object (builder, "compress_entry"));
+ gtk_entry_set_text (GTK_ENTRY (entry), value);
+ }
_builder_init_toggle_button (builder, "mssfix_checkbutton", _hash_get_boolean (hash, NM_OPENVPN_KEY_MSSFIX));
_builder_init_toggle_button (builder, "float_checkbutton", _hash_get_boolean (hash, NM_OPENVPN_KEY_FLOAT));
@@ -1827,7 +1791,6 @@
GtkBuilder *builder;
const char *contype = NULL;
const char *value;
- int active;
int proxy_type = PROXY_TYPE_NONE;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -1934,12 +1897,16 @@
}
}
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "lzo_checkbutton"));
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "compress_checkbutton"));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
- combo = GTK_WIDGET (gtk_builder_get_object (builder, "lzo_combo"));
- active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
- if (active >= 0 && active < G_N_ELEMENTS (comp_lzo_values))
- g_hash_table_insert (hash, NM_OPENVPN_KEY_COMP_LZO, g_strdup (comp_lzo_values[active]));
+ combo = GTK_WIDGET (gtk_builder_get_object (builder, "compress_combo"));
+ value = gtk_combo_box_get_active_id (GTK_COMBO_BOX (combo));
+ if (!value) {
+ entry = GTK_WIDGET (gtk_builder_get_object (builder, "compress_entry"));
+ value = gtk_entry_get_text (GTK_ENTRY (entry));
+ }
+ if (value && *value)
+ g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_COMPRESS), g_strdup (value));
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "mssfix_checkbutton"));
diff -X exclude.txt -uNr a/properties/nm-openvpn-editor.h b/properties/nm-openvpn-editor.h
--- a/properties/nm-openvpn-editor.h 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/nm-openvpn-editor.h 2019-08-16 10:56:25.959949795 +0200
@@ -1,8 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/***************************************************************************
- * nm-openvpn-editor.h : GNOME UI dialogs for configuring openvpn VPN connections
- *
- * Copyright (C) 2008 Dan Williams, <dcbw@redhat.com>
+/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,7 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- **************************************************************************/
+ * Copyright (C) 2008 Dan Williams, <dcbw@redhat.com>
+ * Copyright (C) 2008 - 2018 Red Hat, Inc.
+ */
#ifndef __NM_OPENVPN_EDITOR_H__
#define __NM_OPENVPN_EDITOR_H__
diff -X exclude.txt -uNr a/properties/nm-openvpn-editor-plugin.c b/properties/nm-openvpn-editor-plugin.c
--- a/properties/nm-openvpn-editor-plugin.c 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/nm-openvpn-editor-plugin.c 2019-08-16 10:56:25.959949795 +0200
@@ -1,11 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/***************************************************************************
- * nm-openvpn-editor-plugin.c : GNOME UI dialogs for configuring openvpn VPN connections
- *
- * Copyright (C) 2005 Tim Niemueller <tim@niemueller.de>
- * Copyright (C) 2008 - 2010 Dan Williams, <dcbw@redhat.com>
- * Copyright (C) 2008 - 2011 Red Hat, Inc.
- * Based on work by David Zeuthen, <davidz@redhat.com>
+/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,7 +15,11 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- **************************************************************************/
+ * Based on work by David Zeuthen, <davidz@redhat.com>
+ * Copyright (C) 2005 Tim Niemueller <tim@niemueller.de>
+ * Copyright (C) 2008 - 2010 Dan Williams, <dcbw@redhat.com>
+ * Copyright (C) 2008 - 2018 Red Hat, Inc.
+ */
#include "nm-default.h"
diff -X exclude.txt -uNr a/properties/nm-openvpn-editor-plugin.h b/properties/nm-openvpn-editor-plugin.h
--- a/properties/nm-openvpn-editor-plugin.h 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/nm-openvpn-editor-plugin.h 2019-08-16 10:56:25.959949795 +0200
@@ -1,8 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/***************************************************************************
- * nm-openvpn-editor.h : GNOME UI dialogs for configuring openvpn VPN connections
- *
- * Copyright (C) 2008 Dan Williams, <dcbw@redhat.com>
+/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,7 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- **************************************************************************/
+ * Copyright (C) 2008 Dan Williams, <dcbw@redhat.com>
+ * Copyright (C) 2008 - 2018 Red Hat, Inc.
+ */
#ifndef __NM_OPENVPN_EDITOR_PLUGIN_H__
#define __NM_OPENVPN_EDITOR_PLUGIN_H__
diff -X exclude.txt -uNr a/properties/tests/conf/compress.ovpn b/properties/tests/conf/compress.ovpn
--- a/properties/tests/conf/compress.ovpn 1970-01-01 01:00:00.000000000 +0100
+++ b/properties/tests/conf/compress.ovpn 2019-08-16 10:56:25.959949795 +0200
@@ -0,0 +1,6 @@
+remote 173.8.149.245 666
+dev tun
+client
+
+comp-lzo
+compress lzo
diff -X exclude.txt -uNr a/properties/tests/conf/connect-timeout.ovpn b/properties/tests/conf/connect-timeout.ovpn
--- a/properties/tests/conf/connect-timeout.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/connect-timeout.ovpn 2019-08-16 10:56:25.959949795 +0200
@@ -20,6 +20,6 @@
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 4
diff -X exclude.txt -uNr a/properties/tests/conf/crl-dir.ovpn b/properties/tests/conf/crl-dir.ovpn
--- a/properties/tests/conf/crl-dir.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/crl-dir.ovpn 2019-08-16 10:56:25.959949795 +0200
@@ -16,7 +16,7 @@
cert keys/clee.crt
key keys/clee.key
-comp-lzo
+compress
verb 3
crl-verify /home/user/.cert/crls/ dir
\ Kein Zeilenumbruch am Dateiende.
diff -X exclude.txt -uNr a/properties/tests/conf/crl-file.ovpn b/properties/tests/conf/crl-file.ovpn
--- a/properties/tests/conf/crl-file.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/crl-file.ovpn 2019-08-16 10:56:25.959949795 +0200
@@ -16,7 +16,7 @@
cert keys/clee.crt
key keys/clee.key
-comp-lzo
+compress
verb 3
crl-verify /home/user/.cert/crl.pem
\ Kein Zeilenumbruch am Dateiende.
diff -X exclude.txt -uNr a/properties/tests/conf/device-notype.ovpn b/properties/tests/conf/device-notype.ovpn
--- a/properties/tests/conf/device-notype.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/device-notype.ovpn 2019-08-16 10:56:25.959949795 +0200
@@ -9,7 +9,7 @@
persist-tun
user openvpn
group openvpn
-comp-lzo
+compress
tun-mtu 1500
mssfix 1450
auth-user-pass
diff -X exclude.txt -uNr a/properties/tests/conf/device.ovpn b/properties/tests/conf/device.ovpn
--- a/properties/tests/conf/device.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/device.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -10,7 +10,7 @@
persist-tun
user openvpn
group openvpn
-comp-lzo
+compress
tun-mtu 1500
mssfix 1450
auth-user-pass
diff -X exclude.txt -uNr a/properties/tests/conf/keepalive.ovpn b/properties/tests/conf/keepalive.ovpn
--- a/properties/tests/conf/keepalive.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/keepalive.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -19,7 +19,7 @@
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
keepalive 10 30
diff -X exclude.txt -uNr a/properties/tests/conf/keysize.ovpn b/properties/tests/conf/keysize.ovpn
--- a/properties/tests/conf/keysize.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/keysize.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -6,7 +6,7 @@
nobind
persist-key
persist-tun
-comp-lzo
+compress
tun-mtu 1500
mssfix 1450
auth-user-pass
diff -X exclude.txt -uNr a/properties/tests/conf/mtu-disc.ovpn b/properties/tests/conf/mtu-disc.ovpn
--- a/properties/tests/conf/mtu-disc.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/mtu-disc.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -10,7 +10,7 @@
persist-tun
user openvpn
group openvpn
-comp-lzo
+compress
tun-mtu 1500
mssfix 1450
auth-user-pass
diff -X exclude.txt -uNr a/properties/tests/conf/ping-with-exit.ovpn b/properties/tests/conf/ping-with-exit.ovpn
--- a/properties/tests/conf/ping-with-exit.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/ping-with-exit.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -19,7 +19,7 @@
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
ping 10
diff -X exclude.txt -uNr a/properties/tests/conf/ping-with-restart.ovpn b/properties/tests/conf/ping-with-restart.ovpn
--- a/properties/tests/conf/ping-with-restart.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/ping-with-restart.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -19,7 +19,7 @@
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
ping 10
diff -X exclude.txt -uNr a/properties/tests/conf/pkcs12.ovpn b/properties/tests/conf/pkcs12.ovpn
--- a/properties/tests/conf/pkcs12.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/pkcs12.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -12,6 +12,6 @@
pkcs12 keys/mine.p12
-comp-lzo
+compress
verb 3
diff -X exclude.txt -uNr a/properties/tests/conf/port.ovpn b/properties/tests/conf/port.ovpn
--- a/properties/tests/conf/port.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/port.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -19,6 +19,6 @@
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
diff -X exclude.txt -uNr a/properties/tests/conf/route.ovpn b/properties/tests/conf/route.ovpn
--- a/properties/tests/conf/route.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/route.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -21,6 +21,6 @@
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
diff -X exclude.txt -uNr a/properties/tests/conf/rport.ovpn b/properties/tests/conf/rport.ovpn
--- a/properties/tests/conf/rport.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/rport.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -19,6 +19,6 @@
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 3
diff -X exclude.txt -uNr a/properties/tests/conf/server-poll-timeout.ovpn b/properties/tests/conf/server-poll-timeout.ovpn
--- a/properties/tests/conf/server-poll-timeout.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/server-poll-timeout.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -20,6 +20,6 @@
tls-auth keys/46.key 1
tls-remote "/CN=myvpn.company.com"
-comp-lzo
+compress
verb 4
diff -X exclude.txt -uNr a/properties/tests/conf/tls2.ovpn b/properties/tests/conf/tls2.ovpn
--- a/properties/tests/conf/tls2.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/tls2.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -21,6 +21,6 @@
tls-remote "/CN=myvpn.company.com"
verify-x509-name "C=US, L=Cambridge, CN=GNOME, emailAddress=networkmanager-list@gnome.org" subject
-comp-lzo
+compress
verb 3
Binärdateien a/properties/tests/conf/tls-inline.ovpn und b/properties/tests/conf/tls-inline.ovpn sind verschieden.
diff -X exclude.txt -uNr a/properties/tests/conf/tls.ovpn b/properties/tests/conf/tls.ovpn
--- a/properties/tests/conf/tls.ovpn 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/conf/tls.ovpn 2019-08-16 10:56:25.963949797 +0200
@@ -23,6 +23,6 @@
key-direction 1
-comp-lzo
+compress
verb 3
diff -X exclude.txt -uNr a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
--- a/properties/tests/test-import-export.c 2019-02-08 17:02:44.000000000 +0100
+++ b/properties/tests/test-import-export.c 2019-08-16 10:56:25.963949797 +0200
@@ -1,6 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
- * Copyright (C) 2009 Dan Williams, <dcbw@redhat.com>
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,6 +15,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
+ * Copyright (C) 2009 Dan Williams, <dcbw@redhat.com>
+ * Copyright (C) 2008 - 2018 Red Hat, Inc.
*/
#include "nm-default.h"
@@ -213,6 +214,7 @@
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, "0");
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "test.server.com:443");
@@ -308,7 +310,8 @@
_check_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, NM_OPENVPN_CONTYPE_TLS);
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
- _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "173.8.149.245:1194");
@@ -354,7 +357,8 @@
_check_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, NM_OPENVPN_CONTYPE_TLS);
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
- _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "173.8.149.245:1194");
@@ -420,7 +424,8 @@
_check_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, NM_OPENVPN_CONTYPE_TLS);
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
- _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "173.8.149.245:1194");
@@ -469,7 +474,8 @@
_check_item (s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, NM_OPENVPN_CONTYPE_TLS);
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
- _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "173.8.149.245:1194");
@@ -536,6 +542,7 @@
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "10.11.12.13");
@@ -643,6 +650,7 @@
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, "0");
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "[aa:bb::1]:1194:udp");
@@ -706,6 +714,7 @@
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, "0");
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "test.server.com:443");
@@ -743,6 +752,7 @@
_check_item (s_vpn, NM_OPENVPN_KEY_DEV, "tun");
_check_item (s_vpn, NM_OPENVPN_KEY_PROTO_TCP, "yes");
_check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_FLOAT, NULL);
_check_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, "0");
_check_item (s_vpn, NM_OPENVPN_KEY_REMOTE, "test.server.com:443");
@@ -1008,6 +1018,27 @@
do_test_args_parse_line ("\"\\ b \\ \\a \"a\\ 'b' sd\\", FALSE);
}
+static void
+test_compress_import (void)
+{
+ _CREATE_PLUGIN (plugin);
+ NMConnection *connection;
+ NMSettingVpn *s_vpn;
+
+ connection = get_basic_connection (plugin, SRCDIR, "compress.ovpn");
+ g_assert (connection);
+
+ /* VPN setting */
+ s_vpn = nm_connection_get_setting_vpn (connection);
+ g_assert (s_vpn);
+
+ /* Data items */
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO, "adaptive");
+ _check_item (s_vpn, NM_OPENVPN_KEY_COMPRESS, "lzo");
+
+ g_object_unref (connection);
+}
+
/*****************************************************************************/
NMTST_DEFINE ();
@@ -1101,6 +1132,9 @@
_add_test_func_simple (test_route_import);
_add_test_func ("route-export", test_export_compare, "route.ovpn", "route.ovpntest");
+ _add_test_func_simple (test_compress_import);
+ _add_test_func ("compress-export", test_export_compare, "compress.ovpn", "compress.ovpntest");
+
_add_test_func_simple (test_args_parse_line);
result = g_test_run ();
diff -X exclude.txt -uNr a/shared/nm-service-defines.h b/shared/nm-service-defines.h
--- a/shared/nm-service-defines.h 2019-02-08 17:02:44.000000000 +0100
+++ b/shared/nm-service-defines.h 2019-08-16 11:07:00.400430195 +0200
@@ -1,7 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
- * Copyright (C) 2005 - 2008 Tim Niemueller <tim@niemueller.de>
- * Copyright (C) 2005 - 2008 Dan Williams <dcbw@redhat.com>
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,6 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
+ * Copyright (C) 2005 - 2008 Tim Niemueller <tim@niemueller.de>
+ * Copyright (C) 2005 - 2008 Dan Williams <dcbw@redhat.com>
+ * Copyright (C) 2010 - 2018 Red Hat, Inc.
*/
#ifndef __NM_SERVICE_DEFINES_H__
@@ -33,6 +34,7 @@
#define NM_OPENVPN_KEY_CERT "cert"
#define NM_OPENVPN_KEY_CIPHER "cipher"
#define NM_OPENVPN_KEY_COMP_LZO "comp-lzo"
+#define NM_OPENVPN_KEY_COMPRESS "compress"
#define NM_OPENVPN_KEY_CONNECTION_TYPE "connection-type"
#define NM_OPENVPN_KEY_CONNECT_TIMEOUT "connect-timeout"
#define NM_OPENVPN_KEY_CRL_VERIFY_FILE "crl-verify-file"
diff -X exclude.txt -uNr a/shared/utils.c b/shared/utils.c
--- a/shared/utils.c 2019-02-08 17:02:44.000000000 +0100
+++ b/shared/utils.c 2019-08-16 10:56:25.963949797 +0200
@@ -1,5 +1,6 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
+ *
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -16,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2010 Red Hat, Inc.
+ * Copyright (C) 2010 - 2018 Red Hat, Inc.
*/
#include "nm-default.h"
diff -X exclude.txt -uNr a/shared/utils.h b/shared/utils.h
--- a/shared/utils.h 2019-02-08 17:02:44.000000000 +0100
+++ b/shared/utils.h 2019-08-16 10:56:25.963949797 +0200
@@ -1,5 +1,6 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
+ *
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -16,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2010 Red Hat, Inc.
+ * Copyright (C) 2010 - 2018 Red Hat, Inc.
*/
#ifndef UTILS_H
@@ -31,6 +32,7 @@
#define NMV_OVPN_TAG_CIPHER "cipher"
#define NMV_OVPN_TAG_CLIENT "client"
#define NMV_OVPN_TAG_COMP_LZO "comp-lzo"
+#define NMV_OVPN_TAG_COMPRESS "compress"
#define NMV_OVPN_TAG_CONNECT_TIMEOUT "connect-timeout"
#define NMV_OVPN_TAG_CRL_VERIFY "crl-verify"
#define NMV_OVPN_TAG_DEV "dev"
diff -X exclude.txt -uNr a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
--- a/src/nm-openvpn-service.c 2019-02-08 17:02:44.000000000 +0100
+++ b/src/nm-openvpn-service.c 2019-08-16 11:08:18.808637993 +0200
@@ -1,8 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* nm-openvpn-service - openvpn integration with NetworkManager
- *
- * Copyright (C) 2005 - 2008 Tim Niemueller <tim@niemueller.de>
- * Copyright (C) 2005 - 2010 Dan Williams <dcbw@redhat.com>
+/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,8 +15,9 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * $Id: nm-openvpn-service.c 4232 2008-10-29 09:13:40Z tambeti $
- *
+ * Copyright (C) 2005 - 2008 Tim Niemueller <tim@niemueller.de>
+ * Copyright (C) 2005 - 2010 Dan Williams <dcbw@redhat.com>
+ * Copyright (C) 2008 - 2018 Red Hat, Inc.
*/
#include "nm-default.h"
@@ -146,6 +144,7 @@
{ NM_OPENVPN_KEY_CIPHER, G_TYPE_STRING, 0, 0, FALSE },
{ NM_OPENVPN_KEY_KEYSIZE, G_TYPE_INT, 1, 65535, FALSE },
{ NM_OPENVPN_KEY_COMP_LZO, G_TYPE_STRING, 0, 0, FALSE },
+ { NM_OPENVPN_KEY_COMPRESS, G_TYPE_STRING, 0, 0, FALSE },
{ NM_OPENVPN_KEY_CONNECT_TIMEOUT, G_TYPE_INT, 0, G_MAXINT, FALSE },
{ NM_OPENVPN_KEY_CONNECTION_TYPE, G_TYPE_STRING, 0, 0, FALSE },
{ NM_OPENVPN_KEY_CRL_VERIFY_FILE, G_TYPE_STRING, 0, 0, FALSE },
@@ -1319,6 +1318,7 @@
GPid pid;
gboolean dev_type_is_tap;
const char *defport, *proto_tcp;
+ const char *compress;
const char *tls_remote = NULL;
const char *nm_openvpn_user, *nm_openvpn_group, *nm_openvpn_chroot;
gs_free char *bus_name = NULL;
@@ -1474,33 +1474,53 @@
}
}
+ /* New (2.4+) compress option ("lz4", "lzo", ...) */
+ compress = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_COMPRESS);
+ /* Legacy option ("yes", "adaptive", "no", ...) */
tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_COMP_LZO);
-
- /* openvpn understands 4 different modes for --comp-lzo, which have
- * different meaning:
- * 1) no --comp-lzo option
- * 2) --comp-lzo yes
- * 3) --comp-lzo [adaptive]
- * 4) --comp-lzo no
- *
- * In the past, nm-openvpn only supported 1) and 2) by having no
- * comp-lzo connection setting or "comp-lzo=yes", respectively.
- *
- * However, old plasma-nm would set "comp-lzo=no" in the connection
- * to mean 1). Thus, "comp-lzo=no" is spoiled to mean 4) in order
- * to preserve backward compatibily.
- * We use instead a special value "no-by-default" to express "no".
- *
- * See bgo#769177
- */
- if (NM_IN_STRSET (tmp, "no")) {
- /* means no --comp-lzo option. */
+ if (g_strcmp0 (tmp, "no") == 0) {
+ /*
+ * Treat "no" as if the option was not present: old plasma-nm would
+ * set "comp-lzo=no" in the connection if the option was not to be
+ at all before we would treat it as an explicit disable.
+ * To preserve backward compatibily, we instead used a special value
+ * of "no-by-default" to express "no". See bgo#769177 (or not)
+ */
tmp = NULL;
- } else if (NM_IN_STRSET (tmp, "no-by-default"))
- tmp = "no";
-
- if (NM_IN_STRSET (tmp, "yes", "no", "adaptive"))
- args_add_strv (args, "--comp-lzo", tmp);
+ }
+ if (compress && tmp) {
+ _LOGW ("ignoring the comp-lzo option as compress option is present");
+ tmp = NULL;
+ }
+ if (tmp) {
+ /* We only have the legacy option. Set the compression algorithm from it. */
+ if (strcmp (tmp, "yes") == 0) {
+ compress = "lzo";
+ } else if (strcmp (tmp, "no-by-default") == 0) {
+ compress = "no";
+ } else if (strcmp (tmp, "adaptive") == 0) {
+ compress = "yes";
+ }
+ }
+ if (openvpn_binary_detect_version_cached (openvpn_binary, &openvpn_binary_version) == OPENVPN_BINARY_VERSION_2_4_OR_NEWER) {
+ if (g_strcmp0 (compress, "yes") == 0)
+ g_ptr_array_add (args, "--compress");
+ else if (g_strcmp0 (compress, "no") != 0)
+ args_add_strv (args, "--compress", compress);
+ } else {
+ if (g_strcmp0 (compress, "yes") == 0)
+ args_add_strv (args, "--comp-lzo", "adaptive");
+ else if (g_strcmp0 (compress, "lzo") != 0)
+ args_add_strv (args, "--comp-lzo", "yes");
+ else if (g_strcmp0 (compress, "no") != 0)
+ args_add_strv (args, "--comp-lzo", "no");
+ else {
+ /* An option that has no --comp-lzo equivalent. Set the new one
+ * and hope for the best. Perhaps the user is using some development
+ * snapshot or something. */
+ args_add_strv (args, "--compress", compress);
+ }
+ }
tmp = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_FLOAT);
if (nm_streq0 (tmp, "yes"))
diff -X exclude.txt -uNr a/src/nm-openvpn-service-openvpn-helper.c b/src/nm-openvpn-service-openvpn-helper.c
--- a/src/nm-openvpn-service-openvpn-helper.c 2019-02-08 17:02:44.000000000 +0100
+++ b/src/nm-openvpn-service-openvpn-helper.c 2019-08-16 10:56:25.963949797 +0200
@@ -1,6 +1,5 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* nm-openvpn-service-openvpn-helper - helper called after OpenVPN established
- * a connection, uses DBUS to send information back to nm-openvpn-service
+/*
+ * network-manager-openvpn - OpenVPN integration with NetworkManager
*
* Tim Niemueller [www.niemueller.de]
* Based on work by Dan Williams <dcbw@redhat.com>
@@ -19,10 +18,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2005 Red Hat, Inc.
- * (C) Copyright 2005 Tim Niemueller
- *
- * $Id: nm-openvpn-service-openvpn-helper.c 4170 2008-10-11 14:44:45Z dcbw $
+ * Copyright (C) 2005 Tim Niemueller
+ * Copyright (C) 2005 - 2018 Red Hat, Inc.
*/
#include "nm-default.h"