[NetworkManager-openvpn: 4/8] properties/import-export: support the compress option
- From: Beniamino Galvani <bgalvani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-openvpn: 4/8] properties/import-export: support the compress option
- Date: Thu, 27 Feb 2020 21:26:11 +0000 (UTC)
commit 47b3349fe9ac0bc98909b2661d5fb919154c6599
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Thu Jul 12 21:45:07 2018 +0200
properties/import-export: support the compress option
Co-authored-by: Beniamino Galvani <bgalvani redhat com>
properties/import-export.c | 23 ++++++++++++++++++++++-
shared/utils.h | 1 +
2 files changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index da6365e..81f02d1 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -1008,7 +1008,7 @@ do_import (const char *path, const char *contents, gsize contents_len, GError **
if (nm_streq (v, "no")) {
/* old plasma-nm used to set "comp-lzo=no" to mean unset, thus it spoiled
- * to "no" option to be used in the connection. Workaround that, by instead
+ * the "no" option to be used in the connection. Workaround that, by instead
* using "no-by-default" (bgo#769177). */
v = "no-by-default";
} else if (!NM_IN_STRSET (v, "yes", "adaptive")) {
@@ -1019,6 +1019,21 @@ do_import (const char *path, const char *contents, gsize contents_len, GError **
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 (!NM_IN_STRSET (params[1], "lzo", "lz4")) {
+ line_error = g_strdup_printf (_("unsupported compress argument"));
+ 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;
@@ -1999,6 +2014,12 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
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 --git a/shared/utils.h b/shared/utils.h
index 3373658..78ef7d6 100644
--- a/shared/utils.h
+++ b/shared/utils.h
@@ -32,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"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]