File compress.patch of Package plasma-nm5
diff -X exclude.txt -uNr a/vpn/openvpn/nm-openvpn-service.h b/vpn/openvpn/nm-openvpn-service.h
--- a/vpn/openvpn/nm-openvpn-service.h 2019-03-05 13:27:58.000000000 +0100
+++ b/vpn/openvpn/nm-openvpn-service.h 2019-08-16 13:16:11.437214379 +0200
@@ -33,6 +33,7 @@
#define NM_OPENVPN_KEY_CIPHER "cipher"
#define NM_OPENVPN_KEY_KEYSIZE "keysize"
#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_FLOAT "float"
#define NM_OPENVPN_KEY_FRAGMENT_SIZE "fragment-size"
diff -X exclude.txt -uNr a/vpn/openvpn/openvpnadvanced.ui b/vpn/openvpn/openvpnadvanced.ui
--- a/vpn/openvpn/openvpnadvanced.ui 2019-03-05 13:27:58.000000000 +0100
+++ b/vpn/openvpn/openvpnadvanced.ui 2019-08-16 13:46:48.627815039 +0200
@@ -131,6 +131,50 @@
</layout>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_121">
+ <item>
+ <widget class="QCheckBox" name="chkUseCompress">
+ <property name="toolTip">
+ <string>Use LZO, LZ4 or LZ4-V2 compression.</string>
+ </property>
+ <property name="text">
+ <string>Use LZO, LZ4 or LZ4-V2 compression</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="cmbUseCompress">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Use LZO, LZ4 or LZ4-V2 compression.</string>
+ </property>
+ <item>
+ <property name="text">
+ <string>No</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>LZO</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>LZ4</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>LZ4-V2</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<widget class="QCheckBox" name="chkUseTCP">
<property name="toolTip">
<string>Use TCP for communicating with remote host.</string>
@@ -1183,6 +1227,7 @@
<tabstop>chkUseVirtualDeviceName</tabstop>
<tabstop>leVirtualDeviceName</tabstop>
<tabstop>chkUseLZO</tabstop>
+ <tabstop>chkUseCompress</tabstop>
<tabstop>chkUseTCP</tabstop>
<tabstop>chkMssRestrict</tabstop>
<tabstop>chkRandRemHosts</tabstop>
@@ -1404,6 +1449,22 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
+ <x>145</x>
+ <y>131</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>408</x>
+ <y>132</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>chkUseCompress</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>cmbUseCompress</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
<x>145</x>
<y>131</y>
</hint>
diff -X exclude.txt -uNr a/vpn/openvpn/openvpnadvancedwidget.cpp b/vpn/openvpn/openvpnadvancedwidget.cpp
--- a/vpn/openvpn/openvpnadvancedwidget.cpp 2019-03-05 13:27:58.000000000 +0100
+++ b/vpn/openvpn/openvpnadvancedwidget.cpp 2019-08-16 13:33:05.841395820 +0200
@@ -296,6 +296,19 @@
}
m_ui->chkUseLZO->setChecked(true);
}
+ if (dataMap.contains(QLatin1String(NM_OPENVPN_KEY_COMPRESS))) {
+ const QString compress = dataMap[QLatin1String(NM_OPENVPN_KEY_COMPRESS)];
+ if (compress == QLatin1String("no-by-default")) {
+ m_ui->cmbUseCompress->setCurrentIndex(0);
+ } else if (compress == QLatin1String("lzo")) {
+ m_ui->cmbUseCompress->setCurrentIndex(1);
+ } else if (compress == QLatin1String("lz4")) {
+ m_ui->cmbUseCompress->setCurrentIndex(2);
+ } else {
+ m_ui->cmbUseCompress->setCurrentIndex(3);
+ }
+ m_ui->chkUseCompress->setChecked(true);
+ }
m_ui->chkUseTCP->setChecked(dataMap[QLatin1String(NM_OPENVPN_KEY_PROTO_TCP)] == QLatin1String("yes"));
if (dataMap.contains(QLatin1String(NM_OPENVPN_KEY_DEV_TYPE))) {
m_ui->chkUseVirtualDeviceType->setChecked(true);
@@ -496,6 +509,22 @@
break;
}
}
+ if (m_ui->chkUseCompress->isChecked()) {
+ switch (m_ui->cmbUseCompress->currentIndex()) {
+ case 0:
+ data.insert(QLatin1String(NM_OPENVPN_KEY_COMPRESS), QLatin1String("no-by-default"));
+ break;
+ case 1:
+ data.insert(QLatin1String(NM_OPENVPN_KEY_COMPRESS), QLatin1String("lzo"));
+ break;
+ case 2:
+ data.insert(QLatin1String(NM_OPENVPN_KEY_COMPRESS), QLatin1String("lz4"));
+ break;
+ case 3:
+ data.insert(QLatin1String(NM_OPENVPN_KEY_COMPRESS), QLatin1String("lz4-v2"));
+ break;
+ }
+ }
if (m_ui->chkUseVirtualDeviceType->isChecked()) {
data.insert(QLatin1String(NM_OPENVPN_KEY_DEV_TYPE), m_ui->cmbDeviceType->currentIndex() == 0 ? QLatin1String("tun") : QLatin1String("tap"));
diff -X exclude.txt -uNr a/vpn/openvpn/openvpn.cpp b/vpn/openvpn/openvpn.cpp
--- a/vpn/openvpn/openvpn.cpp 2019-03-05 13:27:58.000000000 +0100
+++ b/vpn/openvpn/openvpn.cpp 2019-08-16 13:19:52.463796641 +0200
@@ -50,6 +50,7 @@
#define CIPHER_TAG "cipher"
#define CLIENT_TAG "client"
#define COMP_TAG "comp-lzo"
+#define COMPRESS_TAG "compress"
#define DEV_TAG "dev"
#define FRAGMENT_TAG "fragment"
#define IFCONFIG_TAG "ifconfig"
@@ -293,6 +294,10 @@
dataMap.insert(QLatin1String(NM_OPENVPN_KEY_COMP_LZO), "yes");
continue;
}
+ if (key_value[0] == COMP_TAG) {
+ dataMap.insert(QLatin1String(NM_OPENVPN_KEY_COMPRESS), "lz4");
+ continue;
+ }
if (key_value[0] == RENEG_SEC_TAG) {
if (key_value.count() == 2) {
if (key_value[1].toLong() >= 0 && key_value[1].toLong() <= 604800 ) {
@@ -793,6 +798,10 @@
line = QString(COMP_TAG) + " yes\n";
expFile.write(line.toLatin1());
}
+ if (dataMap[NM_OPENVPN_KEY_COMPRESS] == "lz4") {
+ line = QString(COMPRESS_TAG) + " lz4\n";
+ expFile.write(line.toLatin1());
+ }
if (dataMap[NM_OPENVPN_KEY_MSSFIX] == "yes") {
line = QString(MSSFIX_TAG) + '\n';
expFile.write(line.toLatin1());