Mailinglist Archive: opensuse-commit (1903 mails)

< Previous Next >
commit libKF5NetworkManagerQt for openSUSE:Factory
Hello community,

here is the log from the commit of package libKF5NetworkManagerQt for
openSUSE:Factory checked in at 2019-04-19 21:25:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libKF5NetworkManagerQt (Old)
and /work/SRC/openSUSE:Factory/.libKF5NetworkManagerQt.new.5536 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libKF5NetworkManagerQt"

Fri Apr 19 21:25:00 2019 rev:64 rq:695260 version:5.57.0

Changes:
--------
---
/work/SRC/openSUSE:Factory/libKF5NetworkManagerQt/libKF5NetworkManagerQt.changes
2019-03-21 09:49:17.562853878 +0100
+++
/work/SRC/openSUSE:Factory/.libKF5NetworkManagerQt.new.5536/libKF5NetworkManagerQt.changes
2019-04-19 21:25:01.995923827 +0200
@@ -1,0 +2,27 @@
+Mon Apr 15 10:26:54 UTC 2019 - wbauer@xxxxxx
+
+- Refresh patches to fix build on Leap 42.3:
+ * 0001-Revert-Add-IpTunnel-setting.patch
+ * 0001-Revert-Add-vxlan-setting.patch
+ * 0001-Revert-Require-NetworkManager-1.4.0-and-newer.patch
+
+-------------------------------------------------------------------
+Sun Apr 14 20:21:45 UTC 2019 - lbeltrame@xxxxxxx
+
+- Update to 5.57.0
+ * New feature release
+ * For more details please see:
+ * https://www.kde.org/announcements/kde-frameworks-5.57.0.php
+- Changes since 5.56.0:
+ * WireGuard: make marshalling/demarshalling of secrets from map to work
+ * Fix constructors
+ * Add missing support for WireGuard into base setting class
+ * WireGuard: fix constructor
+ * WireGuard: fix name
+ * Wireguard: handle private key as secrets
+ * Fix tcsetting test
+ * Wireguard: peers property should be NMVariantMapList
+ * Add Wireguard connection type support
+ * ActiveConnecton: add stateChangedReason signal where we can see the reason
of state change
+
+-------------------------------------------------------------------

Old:
----
networkmanager-qt-5.56.0.tar.xz

New:
----
networkmanager-qt-5.57.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libKF5NetworkManagerQt.spec ++++++
--- /var/tmp/diff_new_pack.pyXeWI/_old 2019-04-19 21:25:02.787924835 +0200
+++ /var/tmp/diff_new_pack.pyXeWI/_new 2019-04-19 21:25:02.791924840 +0200
@@ -17,13 +17,13 @@


%define soversion 6
-%define _tar_path 5.56
+%define _tar_path 5.57
# Full KF5 version (e.g. 5.33.0)
%{!?_kf5_version: %global _kf5_version %{version}}
# Last major and minor KF5 version (e.g. 5.33)
%{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} |
awk -F. '{print $1"."$2}')}
Name: libKF5NetworkManagerQt
-Version: 5.56.0
+Version: 5.57.0
Release: 0
Summary: A Qt wrapper for NetworkManager DBus API
License: LGPL-2.1-only OR LGPL-3.0-only

++++++ 0001-Revert-Add-IpTunnel-setting.patch ++++++
--- /var/tmp/diff_new_pack.pyXeWI/_old 2019-04-19 21:25:02.807924861 +0200
+++ /var/tmp/diff_new_pack.pyXeWI/_new 2019-04-19 21:25:02.807924861 +0200
@@ -236,9 +236,9 @@
- addSetting(Setting::Ptr(new Ipv4Setting()));
- addSetting(Setting::Ptr(new Ipv6Setting()));
- break;
- case ConnectionSettings::Unknown:
- default:
- break;
+ case ConnectionSettings::WireGuard:
+ addSetting(Setting::Ptr(new WireGuardSetting()));
+ addSetting(Setting::Ptr(new Ipv4Setting()));
@@ -327,11 +321,6 @@ void
NetworkManager::ConnectionSettingsPrivate::initSettings(const NetworkManage
addSetting(connectionSettings->setting(Setting::Ipv4));
addSetting(connectionSettings->setting(Setting::Ipv6));
@@ -248,18 +248,18 @@
- addSetting(connectionSettings->setting(Setting::Ipv4));
- addSetting(connectionSettings->setting(Setting::Ipv6));
- break;
- case ConnectionSettings::Unknown:
- default:
- break;
+ case ConnectionSettings::WireGuard:
+ addSetting(connectionSettings->setting(Setting::WireGuard));
+ addSetting(connectionSettings->setting(Setting::Ipv4));
@@ -376,8 +365,6 @@ NetworkManager::ConnectionSettings::ConnectionType
NetworkManager::ConnectionSet
type = Generic;
} else if (typeString == QLatin1String(NM_SETTING_TUN_SETTING_NAME)) {
type = Tun;
- } else if (typeString ==
QLatin1String(NM_SETTING_IP_TUNNEL_SETTING_NAME)) {
- type = IpTunnel;
+ } else if (typeString ==
QLatin1String(NM_SETTING_WIREGUARD_SETTING_NAME)) {
+ type = WireGuard;
}
-
- return type;
@@ -439,9 +426,6 @@ QString
NetworkManager::ConnectionSettings::typeAsString(NetworkManager::Connect
case Tun:
typeString = QLatin1String(NM_SETTING_TUN_SETTING_NAME);
@@ -267,9 +267,9 @@
- case IpTunnel:
- typeString = QLatin1String(NM_SETTING_IP_TUNNEL_SETTING_NAME);
- break;
- default:
+ case WireGuard:
+ typeString = QLatin1String(NM_SETTING_WIREGUARD_SETTING_NAME);
break;
- };
@@ -1094,9 +1078,6 @@ QDebug NetworkManager::operator <<(QDebug dbg, const
NetworkManager::ConnectionS
case Setting::Tun:
dbg.nospace() <<
*(settingPtr.staticCast<NetworkManager::TunSetting>().data());
@@ -277,23 +277,21 @@
- case Setting::IpTunnel:
- dbg.nospace() <<
*(settingPtr.staticCast<NetworkManager::IpTunnelSetting>().data());
- break;
- default:
- dbg.nospace() << *settingPtr.data();
- }
+ case Setting::WireGuard:
+ dbg.nospace() <<
*(settingPtr.staticCast<NetworkManager::WireGuardSetting>().data());
+ break;
diff --git a/src/settings/connectionsettings.h
b/src/settings/connectionsettings.h
index 080bc1a..bb1bc3f 100644
--- a/src/settings/connectionsettings.h
+++ b/src/settings/connectionsettings.h
-@@ -65,8 +65,7 @@ public:
- Wireless,
+@@ -66,7 +66,6 @@ public:
Team,
Generic,
-- Tun,
-- IpTunnel
-+ Tun
+ Tun,
+- IpTunnel,
+ WireGuard
};

- enum AutoconnectSlaves {
diff --git a/src/settings/iptunnelsetting.cpp
b/src/settings/iptunnelsetting.cpp
deleted file mode 100644
index 868dfc1..0000000

++++++ 0001-Revert-Add-vxlan-setting.patch ++++++
--- /var/tmp/diff_new_pack.pyXeWI/_old 2019-04-19 21:25:02.819924876 +0200
+++ /var/tmp/diff_new_pack.pyXeWI/_new 2019-04-19 21:25:02.819924876 +0200
@@ -206,9 +206,9 @@
settings/tunsetting.cpp
settings/usersetting.cpp
- settings/vxlansetting.cpp
+ settings/wireguardsetting.cpp
)

- set(DBUS_INTERFACE_SRCS
diff --git a/src/settings/setting.cpp b/src/settings/setting.cpp
index cd8aef9..3986036 100644
--- a/src/settings/setting.cpp

++++++ 0001-Revert-Require-NetworkManager-1.4.0-and-newer.patch ++++++
--- /var/tmp/diff_new_pack.pyXeWI/_old 2019-04-19 21:25:02.827924886 +0200
+++ /var/tmp/diff_new_pack.pyXeWI/_new 2019-04-19 21:25:02.827924886 +0200
@@ -213,28 +213,34 @@
index ea210f9..db6f476 100644
--- a/src/activeconnection.cpp
+++ b/src/activeconnection.cpp
-@@ -67,8 +67,12 @@ NetworkManager::ActiveConnection::ActiveConnection(const
QString &path, QObject
+@@ -67,10 +67,15 @@ NetworkManager::ActiveConnection::ActiveConnection(const
QString &path, QObject
}

#ifndef NMQT_STATIC
+#if NM_CHECK_VERSION(1, 4, 0)
QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
QLatin1String("PropertiesChanged"),
d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList)));
+ QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
+ QLatin1String("StateChanged"), d,
SLOT(stateChanged(uint,uint)));
+#else
+ connect(&d->iface,
&OrgFreedesktopNetworkManagerConnectionActiveInterface::PropertiesChanged, d,
&ActiveConnectionPrivate::propertiesChanged);
++ connect(&d->iface,
&OrgFreedesktopNetworkManagerConnectionActiveInterface::StateChanged, d,
&ActiveConnectionPrivate::stateChanged);
+#endif
#endif

#ifdef NMQT_STATIC
-@@ -90,8 +94,12 @@
NetworkManager::ActiveConnection::ActiveConnection(ActiveConnectionPrivate &dd,
+@@ -90,10 +94,15 @@
NetworkManager::ActiveConnection::ActiveConnection(ActiveConnectionPrivate &dd,
Q_D(ActiveConnection);

#ifndef NMQT_STATIC
+#if NM_CHECK_VERSION(1, 4, 0)
QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
QLatin1String("PropertiesChanged"),
d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList)));
+ QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
+ QLatin1String("StateChanged"), d,
SLOT(stateChanged(uint,uint)));
+#else
+ connect(&d->iface,
&OrgFreedesktopNetworkManagerConnectionActiveInterface::PropertiesChanged, d,
&ActiveConnectionPrivate::propertiesChanged);
++ connect(&d->iface,
&OrgFreedesktopNetworkManagerConnectionActiveInterface::StateChanged, d,
&ActiveConnectionPrivate::stateChanged);
+#endif
#endif


++++++ networkmanager-qt-5.56.0.tar.xz -> networkmanager-qt-5.57.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/networkmanager-qt-5.56.0/.gitignore
new/networkmanager-qt-5.57.0/.gitignore
--- old/networkmanager-qt-5.56.0/.gitignore 1970-01-01 01:00:00.000000000
+0100
+++ new/networkmanager-qt-5.57.0/.gitignore 2019-04-07 09:21:21.000000000
+0200
@@ -0,0 +1,21 @@
+# Ignore the following files
+*~
+*.[oa]
+*.diff
+*.kate-swp
+*.kdev4
+.kdev_include_paths
+*.kdevelop.pcs
+*.moc
+*.moc.cpp
+*.orig
+*.user
+.*.swp
+.swp.*
+Doxyfile
+Makefile
+avail
+random_seed
+/build*/
+CMakeLists.txt.user*
+*.unc-backup*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/networkmanager-qt-5.56.0/CMakeLists.txt
new/networkmanager-qt-5.57.0/CMakeLists.txt
--- old/networkmanager-qt-5.56.0/CMakeLists.txt 2019-03-02 14:30:50.000000000
+0100
+++ new/networkmanager-qt-5.57.0/CMakeLists.txt 2019-04-07 09:21:21.000000000
+0200
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.5)

-set(KF5_VERSION "5.56.0") # handled by release scripts
+set(KF5_VERSION "5.57.0") # handled by release scripts
project(NetworkManagerQt VERSION ${KF5_VERSION})

include(FeatureSummary)
-find_package(ECM 5.56.0 NO_MODULE)
+find_package(ECM 5.57.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake
Modules." URL
"https://projects.kde.org/projects/kdesupport/extra-cmake-modules";)
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND
FATAL_ON_MISSING_REQUIRED_PACKAGES)

diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/autotests/activeconnectiontest.cpp
new/networkmanager-qt-5.57.0/autotests/activeconnectiontest.cpp
--- old/networkmanager-qt-5.56.0/autotests/activeconnectiontest.cpp
2019-03-02 14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/autotests/activeconnectiontest.cpp
2019-04-07 09:21:21.000000000 +0200
@@ -82,6 +82,7 @@
void ActiveConnectionTest::testActiveConnection()
{

qRegisterMetaType<NetworkManager::ActiveConnection::State>("NetworkManager::ActiveConnection::State");
+
qRegisterMetaType<NetworkManager::ActiveConnection::Reason>("NetworkManager::ActiveConnection::Reason");

qRegisterMetaType<NetworkManager::Device::State>("NetworkManager::Device::State");

qRegisterMetaType<NetworkManager::Device::StateChangeReason>("NetworkManager::Device::StateChangeReason");

qRegisterMetaType<NetworkManager::Connectivity>("NetworkManager::Connectivity");
@@ -105,6 +106,7 @@

NetworkManager::ActiveConnection::Ptr activeConnection =
NetworkManager::findActiveConnection(activeConnectionAddedSpy.at(0).at(0).toString());
QSignalSpy activeConnectionStateChangedSpy(activeConnection.data(),
SIGNAL(stateChanged(NetworkManager::ActiveConnection::State)));
+ QSignalSpy activeConnectionStateChangedReasonSpy(activeConnection.data(),
SIGNAL(stateChangedReason(NetworkManager::ActiveConnection::State,NetworkManager::ActiveConnection::Reason)));

QCOMPARE(activeConnection->devices().first(), device->uni());
QCOMPARE(activeConnection->state(),
NetworkManager::ActiveConnection::Activating);
@@ -116,6 +118,7 @@
QTest::qWait(800);

QCOMPARE(activeConnectionStateChangedSpy.count(), 1);
+ QCOMPARE(activeConnectionStateChangedReasonSpy.count(), 1);

QCOMPARE(deviceStateChangedSpy.count(), 6);
QCOMPARE(device->ipInterfaceName(), device->interfaceName());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/autotests/settings/CMakeLists.txt
new/networkmanager-qt-5.57.0/autotests/settings/CMakeLists.txt
--- old/networkmanager-qt-5.56.0/autotests/settings/CMakeLists.txt
2019-03-02 14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/autotests/settings/CMakeLists.txt
2019-04-07 09:21:21.000000000 +0200
@@ -39,6 +39,7 @@
vpnsettingtest
wimaxsettingtest
wiredsettingtest
+ wireguardsettingtest
wirelesssettingtest
wirelesssecuritysettingtest
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/autotests/settings/tcsettingtest.cpp
new/networkmanager-qt-5.57.0/autotests/settings/tcsettingtest.cpp
--- old/networkmanager-qt-5.56.0/autotests/settings/tcsettingtest.cpp
2019-03-02 14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/autotests/settings/tcsettingtest.cpp
2019-04-07 09:21:21.000000000 +0200
@@ -79,7 +79,7 @@
for (int i = 0; i < list.size(); ++i) {
QVariantMap varMap = list.at(i);
for (int j = 0; j < list1.size(); ++j) {
- QVariantMap varMap1 = list1.at(i);
+ QVariantMap varMap1 = list1.at(j);
QVariantMap::const_iterator ite = varMap.constBegin();
int comparedvals = 0;
while (ite != varMap.constEnd()) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/autotests/settings/wireguardsettingtest.cpp
new/networkmanager-qt-5.57.0/autotests/settings/wireguardsettingtest.cpp
--- old/networkmanager-qt-5.56.0/autotests/settings/wireguardsettingtest.cpp
1970-01-01 01:00:00.000000000 +0100
+++ new/networkmanager-qt-5.57.0/autotests/settings/wireguardsettingtest.cpp
2019-04-07 09:21:21.000000000 +0200
@@ -0,0 +1,132 @@
+/*
+ Copyright 2019 Jan Grulich <jgrulich@xxxxxxxxxx>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see
<http://www.gnu.org/licenses/>.
+*/
+
+#include "wireguardsettingtest.h"
+
+#include "settings/wireguardsetting.h"
+
+#include <libnm/NetworkManager.h>
+
+#include <QTest>
+
+#if !NM_CHECK_VERSION(1, 16, 0)
+#define NM_SETTING_WIREGUARD_FWMARK "fwmark"
+#define NM_SETTING_WIREGUARD_LISTEN_PORT "listen-port"
+#define NM_SETTING_WIREGUARD_PRIVATE_KEY "private-key"
+#define NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS "private-key-flags"
+#define NM_SETTING_WIREGUARD_PEERS "peers"
+#define NM_SETTING_WIREGUARD_MTU "mtu"
+#define NM_SETTING_WIREGUARD_PEER_ROUTES "peer-routes"
+#endif
+
+void WireGuardSettingTest::testSetting_data()
+{
+ QTest::addColumn<qint32>("fwmark");
+ QTest::addColumn<qint32>("listenPort");
+ QTest::addColumn<qint32>("mtu");
+ QTest::addColumn<bool>("peerRoutes");
+ QTest::addColumn<NMVariantMapList>("peers");
+ QTest::addColumn<QString>("privateKey");
+ QTest::addColumn<quint32>("privateKeyFlags");
+
+ NMVariantMapList peers;
+ QVariantMap map;
+ map.insert("foo", "bar");
+ peers << map;
+
+ QVariantMap map1;
+ map1.insert("foobar", "barfoo");
+ peers << map1;
+
+ QTest::newRow("setting1")
+ << (qint32) 100 // fwmark
+ << (qint32) 101 // listenPort
+ << (qint32) 102 // mtu
+ << false // peerRoutes
+ << peers // peers
+ << QString("private-key") // privateKey
+ << (quint32) 2; // privateKeyFlags
+}
+
+void WireGuardSettingTest::testSetting()
+{
+ QFETCH(qint32, fwmark);
+ QFETCH(qint32, listenPort);
+ QFETCH(qint32, mtu);
+ QFETCH(bool, peerRoutes);
+ QFETCH(NMVariantMapList, peers);
+ QFETCH(QString, privateKey);
+ QFETCH(quint32, privateKeyFlags);
+
+ QVariantMap map;
+
+ map.insert(QLatin1String(NM_SETTING_WIREGUARD_FWMARK), fwmark);
+ map.insert(QLatin1String(NM_SETTING_WIREGUARD_LISTEN_PORT), listenPort);
+ map.insert(QLatin1String(NM_SETTING_WIREGUARD_MTU), mtu);
+ map.insert(QLatin1String(NM_SETTING_WIREGUARD_PEER_ROUTES), peerRoutes);
+ map.insert(QLatin1String(NM_SETTING_WIREGUARD_PEERS),
QVariant::fromValue(peers));
+ map.insert(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY), privateKey);
+ map.insert(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS),
privateKeyFlags);
+
+ NetworkManager::WireGuardSetting setting;
+ setting.fromMap(map);
+
+ QVariantMap map1 = setting.toMap();
+
+ // Will fail if set some default values, because they are skipped in
toMap() method
+ QVariantMap::const_iterator it = map.constBegin();
+ while (it != map.constEnd()) {
+ if (it.key() != QLatin1String(NM_SETTING_WIREGUARD_PEERS)) {
+ QCOMPARE(it.value(), map1.value(it.key()));
+ }
+ ++it;
+ }
+
+ NMVariantMapList list =
map.value(QLatin1String(NM_SETTING_WIREGUARD_PEERS)).value<NMVariantMapList>();
+ NMVariantMapList list1 =
map1.value(QLatin1String(NM_SETTING_WIREGUARD_PEERS)).value<NMVariantMapList>();
+
+ QCOMPARE(list.count(), list1.count());
+
+ int comparedMaps = 0;
+ for (int i = 0; i < list.size(); ++i) {
+ QVariantMap varMap = list.at(i);
+ for (int j = 0; j < list1.size(); ++j) {
+ QVariantMap varMap1 = list1.at(j);
+ QVariantMap::const_iterator ite = varMap.constBegin();
+ int comparedvals = 0;
+ while (ite != varMap.constEnd()) {
+ QVariantMap::const_iterator val1 =
varMap1.constFind(ite.key());
+ if (val1 != varMap1.constEnd()) {
+ if (varMap.value(ite.key()) == val1.value()) {
+ ++comparedvals;
+ }
+ }
+ ++ite;
+ }
+ if (comparedvals == varMap.size()) {
+ comparedMaps++;
+ }
+ }
+ }
+ QCOMPARE(comparedMaps, list.count());
+}
+
+QTEST_MAIN(WireGuardSettingTest)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/autotests/settings/wireguardsettingtest.h
new/networkmanager-qt-5.57.0/autotests/settings/wireguardsettingtest.h
--- old/networkmanager-qt-5.56.0/autotests/settings/wireguardsettingtest.h
1970-01-01 01:00:00.000000000 +0100
+++ new/networkmanager-qt-5.57.0/autotests/settings/wireguardsettingtest.h
2019-04-07 09:21:21.000000000 +0200
@@ -0,0 +1,37 @@
+/*
+ Copyright 2019 Jan Grulich <jgrulich@xxxxxxxxxx>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see
<http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NETWORKMANAGERQT_WIREGUARDSETTING_TEST_H
+#define NETWORKMANAGERQT_WIREGUARDSETTING_TEST_H
+
+#include <QObject>
+
+class WireGuardSettingTest : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void testSetting_data();
+ void testSetting();
+};
+
+#endif // NETWORKMANAGERQT_WIREGUARDSETTING_TEST_H
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/networkmanager-qt-5.56.0/src/CMakeLists.txt
new/networkmanager-qt-5.57.0/src/CMakeLists.txt
--- old/networkmanager-qt-5.56.0/src/CMakeLists.txt 2019-03-02
14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/CMakeLists.txt 2019-04-07
09:21:21.000000000 +0200
@@ -91,6 +91,7 @@
settings/tunsetting.cpp
settings/usersetting.cpp
settings/vxlansetting.cpp
+ settings/wireguardsetting.cpp
)

set(DBUS_INTERFACE_SRCS
@@ -236,6 +237,7 @@
VpnSetting
WimaxSetting
WiredSetting
+ WireguardSetting
WirelessSecuritySetting
WirelessSetting

diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/networkmanager-qt-5.56.0/src/activeconnection.cpp
new/networkmanager-qt-5.57.0/src/activeconnection.cpp
--- old/networkmanager-qt-5.56.0/src/activeconnection.cpp 2019-03-02
14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/activeconnection.cpp 2019-04-07
09:21:21.000000000 +0200
@@ -55,6 +55,11 @@
return (NetworkManager::ActiveConnection::State)state;
}

+NetworkManager::ActiveConnection::Reason
NetworkManager::ActiveConnectionPrivate::convertActiveConnectionReason(uint
reason)
+{
+ return (NetworkManager::ActiveConnection::Reason)reason;
+}
+
NetworkManager::ActiveConnection::ActiveConnection(const QString &path,
QObject *parent)
: QObject(parent), d_ptr(new ActiveConnectionPrivate(path, this))
{
@@ -69,10 +74,13 @@
#ifndef NMQT_STATIC
QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
QLatin1String("PropertiesChanged"),
d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList)));
+ QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
+ QLatin1String("StateChanged"), d,
SLOT(stateChanged(uint,uint)));
#endif

#ifdef NMQT_STATIC
connect(&d->iface,
&OrgFreedesktopNetworkManagerConnectionActiveInterface::PropertiesChanged, d,
&ActiveConnectionPrivate::propertiesChanged);
+ connect(&d->iface,
&OrgFreedesktopNetworkManagerConnectionActiveInterface::StateChanged, d,
&ActiveConnectionPrivate::stateChanged);
#endif

#ifndef NMQT_STATIC
@@ -92,10 +100,13 @@
#ifndef NMQT_STATIC
QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
QLatin1String("PropertiesChanged"),
d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList)));
+ QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE,
d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
+ QLatin1String("StateChanged"), d,
SLOT(stateChanged(uint,uint)));
#endif

#ifdef NMQT_STATIC
connect(&d->iface,
&OrgFreedesktopNetworkManagerConnectionActiveInterface::PropertiesChanged, d,
&ActiveConnectionPrivate::propertiesChanged);
+ connect(&d->iface,
&OrgFreedesktopNetworkManagerConnectionActiveInterface::StateChanged, d,
&ActiveConnectionPrivate::stateChanged);
#endif

#ifndef NMQT_STATIC
@@ -313,6 +324,13 @@
}
}

+void NetworkManager::ActiveConnectionPrivate::stateChanged(uint state, uint
reason)
+{
+ Q_Q(ActiveConnection);
+
+ Q_EMIT q->stateChangedReason(convertActiveConnectionState(state),
convertActiveConnectionReason(reason));
+}
+
void NetworkManager::ActiveConnectionPrivate::propertyChanged(const QString
&property, const QVariant &value)
{
Q_Q(ActiveConnection);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/networkmanager-qt-5.56.0/src/activeconnection.h
new/networkmanager-qt-5.57.0/src/activeconnection.h
--- old/networkmanager-qt-5.56.0/src/activeconnection.h 2019-03-02
14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/activeconnection.h 2019-04-07
09:21:21.000000000 +0200
@@ -58,6 +58,25 @@
Deactivating, /**< The connection is being torn down and cleaned up */
Deactivated /**< The connection is no longer active */
};
+
+ enum Reason {
+ UknownReason = 0, /**< The reason for the active connection state
change is unknown */
+ None, /**< No reason was given for the active connection
state change */
+ UserDisconnected, /**< The active connection changed state because
the user disconnected it */
+ DeviceDisconnected, /**< The active connection changed state because
the device it was using was disconnected */
+ ServiceStopped, /**< The service providing the VPN connection was
stopped */
+ IpConfigInvalid, /**< The IP config of the active connection was
invalid */
+ ConnectTimeout, /**< The connection attempt to the VPN service
timed out */
+ ServiceStartTimeout,/**< A timeout occurred while starting the service
providing the VPN connection */
+ ServiceStartFailed, /**< Starting the service providing the VPN
connection failed */
+ NoSecrets, /**< Necessary secrets for the connection were not
provided */
+ LoginFailed, /**< Authentication to the server failed */
+ ConnectionRemoved, /**< The connection was deleted from settings */
+ DependencyFailed, /**< Master connection of this connection failed
to activate */
+ DeviceRealizeFailed,/**< Could not create the software device link */
+ DeviceRemoved /**< The device this connection depended on
disappeared */
+ };
+
/**
* Creates a new ActiveConnection object.
*
@@ -199,6 +218,11 @@
*/
void stateChanged(NetworkManager::ActiveConnection::State state);
/**
+ * The @p state changed because of reason @p reason
+ * (never emitted in runtime NM < 1.8.0)
+ */
+ void stateChangedReason(NetworkManager::ActiveConnection::State state,
NetworkManager::ActiveConnection::Reason reason);
+ /**
* The VPN property changed.
*/
void vpnChanged(bool isVpn);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/networkmanager-qt-5.56.0/src/activeconnection_p.h
new/networkmanager-qt-5.57.0/src/activeconnection_p.h
--- old/networkmanager-qt-5.56.0/src/activeconnection_p.h 2019-03-02
14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/activeconnection_p.h 2019-04-07
09:21:21.000000000 +0200
@@ -34,6 +34,7 @@
explicit ActiveConnectionPrivate(const QString &, ActiveConnection *q);
virtual ~ActiveConnectionPrivate();
static NetworkManager::ActiveConnection::State
convertActiveConnectionState(uint);
+ static NetworkManager::ActiveConnection::Reason
convertActiveConnectionReason(uint);
NetworkManager::Connection::Ptr connection;
QString path;
bool default4;
@@ -73,6 +74,7 @@

public Q_SLOTS:
void propertiesChanged(const QVariantMap &properties);
+ void stateChanged(uint state, uint reason);

private Q_SLOTS:
void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap
&properties, const QStringList &invalidatedProperties);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/src/fakenetwork/activeconnection.h
new/networkmanager-qt-5.57.0/src/fakenetwork/activeconnection.h
--- old/networkmanager-qt-5.56.0/src/fakenetwork/activeconnection.h
2019-03-02 14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/fakenetwork/activeconnection.h
2019-04-07 09:21:21.000000000 +0200
@@ -91,6 +91,7 @@

Q_SIGNALS:
Q_SCRIPTABLE void PropertiesChanged(const QVariantMap &properties);
+ Q_SCRIPTABLE void StateChanged(uint state, uint reason);

private:
QDBusObjectPath m_connection;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/src/fakenetwork/fakenetwork.cpp
new/networkmanager-qt-5.57.0/src/fakenetwork/fakenetwork.cpp
--- old/networkmanager-qt-5.56.0/src/fakenetwork/fakenetwork.cpp
2019-03-02 14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/fakenetwork/fakenetwork.cpp
2019-04-07 09:21:21.000000000 +0200
@@ -269,6 +269,10 @@
QDBusMessage message =
QDBusMessage::createSignal(activeConnection->activeConnectionPath(),
QLatin1Literal("org.kde.fakenetwork.Connection.Active"),
QLatin1Literal("PropertiesChanged"));
message << activeConnectionMap;
QDBusConnection::sessionBus().send(message);
+
+ QDBusMessage message2 =
QDBusMessage::createSignal(activeConnection->activeConnectionPath(),
QLatin1Literal("org.kde.fakenetwork.Connection.Active"),
QLatin1Literal("StateChanged"));
+ message2 << (uint)2 << (uint)1; //
NM_ACTIVE_CONNECTION_STATE_ACTIVATED << NM_ACTIVE_CONNECTION_STATE_REASON_NONE
+ QDBusConnection::sessionBus().send(message2);
}
// TODO: set dhcp4Config, dhcp6Config, ip4Config, ip6Config
// IP Interface is usually same as interface
@@ -327,6 +331,10 @@
message << activeConnectionMap;
QDBusConnection::sessionBus().send(message);

+ QDBusMessage message2 =
QDBusMessage::createSignal(activeConnection->activeConnectionPath(),
QLatin1Literal("org.kde.fakenetwork.Connection.Active"),
QLatin1Literal("StateChanged"));
+ message2 << (uint)4 << (uint)2; //
NM_ACTIVE_CONNECTION_STATE_DEACTIVATED <<
NM_ACTIVE_CONNECTION_STATE_REASON_USER_DISCONNECTED
+ QDBusConnection::sessionBus().send(message2);
+
Device *device = m_devices.value(activeConnection->devices().first());
if (device) {
m_deactivatedDevice = device->devicePath();
@@ -365,6 +373,10 @@
message << activeConnectionMap;
QDBusConnection::sessionBus().send(message);

+ QDBusMessage message2 =
QDBusMessage::createSignal(activeConnection->activeConnectionPath(),
QLatin1Literal("org.kde.fakenetwork.Connection.Active"),
QLatin1Literal("StateChanged"));
+ message2 << (uint)3 << (uint)2; //
NM_ACTIVE_CONNECTION_STATE_DEACTIVATING <<
NM_ACTIVE_CONNECTION_STATE_REASON_USER_DISCONNECTED
+ QDBusConnection::sessionBus().send(message2);
+

removeActiveConnection(QDBusObjectPath(activeConnection->activeConnectionPath()));
}

diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/src/settings/connectionsettings.cpp
new/networkmanager-qt-5.57.0/src/settings/connectionsettings.cpp
--- old/networkmanager-qt-5.56.0/src/settings/connectionsettings.cpp
2019-03-02 14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/settings/connectionsettings.cpp
2019-04-07 09:21:21.000000000 +0200
@@ -45,6 +45,7 @@
#include "vlansetting.h"
#include "vpnsetting.h"
#include "wimaxsetting.h"
+#include "wireguardsetting.h"

#undef signals
#include <libnm/NetworkManager.h>
@@ -53,6 +54,10 @@
#define NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES "autoconnect-retries"
#endif

+#if !NM_CHECK_VERSION(1, 16, 0)
+#define NM_SETTING_WIREGUARD_SETTING_NAME "wireguard"
+#endif
+
#include "teamsetting.h"
#include "genericsetting.h"

@@ -198,6 +203,11 @@
addSetting(Setting::Ptr(new Ipv4Setting()));
addSetting(Setting::Ptr(new Ipv6Setting()));
break;
+ case ConnectionSettings::WireGuard:
+ addSetting(Setting::Ptr(new WireGuardSetting()));
+ addSetting(Setting::Ptr(new Ipv4Setting()));
+ addSetting(Setting::Ptr(new Ipv6Setting()));
+ break;
case ConnectionSettings::Unknown:
default:
break;
@@ -319,6 +329,11 @@
addSetting(connectionSettings->setting(Setting::Ipv4));
addSetting(connectionSettings->setting(Setting::Ipv6));
break;
+ case ConnectionSettings::WireGuard:
+ addSetting(connectionSettings->setting(Setting::WireGuard));
+ addSetting(connectionSettings->setting(Setting::Ipv4));
+ addSetting(connectionSettings->setting(Setting::Ipv6));
+ break;
case ConnectionSettings::Unknown:
default:
break;
@@ -365,6 +380,8 @@
type = Tun;
} else if (typeString == QLatin1String(NM_SETTING_IP_TUNNEL_SETTING_NAME))
{
type = IpTunnel;
+ } else if (typeString == QLatin1String(NM_SETTING_WIREGUARD_SETTING_NAME))
{
+ type = WireGuard;
}

return type;
@@ -429,6 +446,9 @@
case IpTunnel:
typeString = QLatin1String(NM_SETTING_IP_TUNNEL_SETTING_NAME);
break;
+ case WireGuard:
+ typeString = QLatin1String(NM_SETTING_WIREGUARD_SETTING_NAME);
+ break;
default:
break;
};
@@ -1084,6 +1104,9 @@
case Setting::IpTunnel:
dbg.nospace() <<
*(settingPtr.staticCast<NetworkManager::IpTunnelSetting>().data());
break;
+ case Setting::WireGuard:
+ dbg.nospace() <<
*(settingPtr.staticCast<NetworkManager::WireGuardSetting>().data());
+ break;
default:
dbg.nospace() << *settingPtr.data();
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/src/settings/connectionsettings.h
new/networkmanager-qt-5.57.0/src/settings/connectionsettings.h
--- old/networkmanager-qt-5.56.0/src/settings/connectionsettings.h
2019-03-02 14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/settings/connectionsettings.h
2019-04-07 09:21:21.000000000 +0200
@@ -66,7 +66,8 @@
Team,
Generic,
Tun,
- IpTunnel
+ IpTunnel,
+ WireGuard
};

enum AutoconnectSlaves {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/networkmanager-qt-5.56.0/src/settings/setting.cpp
new/networkmanager-qt-5.57.0/src/settings/setting.cpp
--- old/networkmanager-qt-5.56.0/src/settings/setting.cpp 2019-03-02
14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/settings/setting.cpp 2019-04-07
09:21:21.000000000 +0200
@@ -27,6 +27,10 @@

#include <QDebug>

+#if !NM_CHECK_VERSION(1, 16, 0)
+#define NM_SETTING_WIREGUARD_SETTING_NAME "wireguard"
+#endif
+
#if !NM_CHECK_VERSION(1, 14, 0)
#define NM_SETTING_MATCH_SETTING_NAME "match"
#endif
@@ -176,6 +180,9 @@
case Dcb:
typeString = QLatin1String(NM_SETTING_DCB_SETTING_NAME);
break;
+ case NetworkManager::Setting::WireGuard:
+ typeString = QLatin1String(NM_SETTING_WIREGUARD_SETTING_NAME);
+ break;
case NetworkManager::Setting::Generic:
typeString = QLatin1String(NM_SETTING_GENERIC_SETTING_NAME);
break;
@@ -256,6 +263,8 @@
type = Macsec;
} else if (typeString == QLatin1String(NM_SETTING_DCB_SETTING_NAME)) {
type = Dcb;
+ } else if (typeString == QLatin1String(NM_SETTING_WIREGUARD_SETTING_NAME))
{
+ type = WireGuard;
}

return type;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/networkmanager-qt-5.56.0/src/settings/setting.h
new/networkmanager-qt-5.57.0/src/settings/setting.h
--- old/networkmanager-qt-5.56.0/src/settings/setting.h 2019-03-02
14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/settings/setting.h 2019-04-07
09:21:21.000000000 +0200
@@ -1,5 +1,5 @@
/*
- Copyright 2012-2013 Jan Grulich <jgrulich@xxxxxxxxxx>
+ Copyright 2012-2019 Jan Grulich <jgrulich@xxxxxxxxxx>

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -84,7 +84,8 @@
Tc,
TeamPort,
Macsec,
- Dcb
+ Dcb,
+ WireGuard
};

enum SecretFlagType {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/src/settings/wireguardsetting.cpp
new/networkmanager-qt-5.57.0/src/settings/wireguardsetting.cpp
--- old/networkmanager-qt-5.56.0/src/settings/wireguardsetting.cpp
1970-01-01 01:00:00.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/settings/wireguardsetting.cpp
2019-04-07 09:21:21.000000000 +0200
@@ -0,0 +1,388 @@
+/*
+ Copyright 2019 Jan Grulich <jgrulich@xxxxxxxxxx>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see
<http://www.gnu.org/licenses/>.
+*/
+
+#include "wireguardsetting.h"
+#include "wireguardsetting_p.h"
+
+#include <QDebug>
+
+#if !NM_CHECK_VERSION(1, 16, 0)
+#define NM_SETTING_WIREGUARD_SETTING_NAME "wireguard"
+
+#define NM_SETTING_WIREGUARD_FWMARK "fwmark"
+#define NM_SETTING_WIREGUARD_LISTEN_PORT "listen-port"
+#define NM_SETTING_WIREGUARD_PRIVATE_KEY "private-key"
+#define NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS "private-key-flags"
+#define NM_SETTING_WIREGUARD_PEERS "peers"
+#define NM_SETTING_WIREGUARD_MTU "mtu"
+#define NM_SETTING_WIREGUARD_PEER_ROUTES "peer-routes"
+
+#define NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY "preshared-key"
+#define NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY_FLAGS "preshared-key-flags"
+#define NM_WIREGUARD_PEER_ATTR_PUBLIC_KEY "public-key"
+#endif
+
+NetworkManager::WireGuardSettingPrivate::WireGuardSettingPrivate()
+ : name(NM_SETTING_WIREGUARD_SETTING_NAME)
+ , fwmark(0)
+ , listenPort(0)
+ , mtu(0)
+ , peerRoutes(true)
+ , privateKeyFlags(NetworkManager::Setting::None)
+{ }
+
+NetworkManager::WireGuardSetting::WireGuardSetting()
+ : Setting(Setting::WireGuard)
+ , d_ptr(new WireGuardSettingPrivate())
+{ }
+
+NetworkManager::WireGuardSetting::WireGuardSetting(const Ptr &other)
+ : Setting(other)
+ , d_ptr(new WireGuardSettingPrivate())
+{
+ setFwmark(other->fwmark());
+ setListenPort(other->listenPort());
+ setMtu(other->mtu());
+ setPeerRoutes(other->peerRoutes());
+ setPeers(other->peers());
+ setPrivateKey(other->privateKey());
+ setPrivateKeyFlags(other->privateKeyFlags());
+}
+
+NetworkManager::WireGuardSetting::~WireGuardSetting()
+{
+ delete d_ptr;
+}
+
+QString NetworkManager::WireGuardSetting::name() const
+{
+ Q_D(const WireGuardSetting);
+
+ return d->name;
+}
+
+quint32 NetworkManager::WireGuardSetting::fwmark() const
+{
+ Q_D(const WireGuardSetting);
+
+ return d->fwmark;
+}
+
+void NetworkManager::WireGuardSetting::setFwmark(quint32 fwmark)
+{
+ Q_D(WireGuardSetting);
+
+ d->fwmark = fwmark;
+}
+
+quint32 NetworkManager::WireGuardSetting::listenPort() const
+{
+ Q_D(const WireGuardSetting);
+
+ return d->listenPort;
+}
+
+void NetworkManager::WireGuardSetting::setListenPort(quint32 port)
+{
+ Q_D(WireGuardSetting);
+
+ d->listenPort = port;
+}
+
+quint32 NetworkManager::WireGuardSetting::mtu() const
+{
+ Q_D(const WireGuardSetting);
+
+ return d->mtu;
+
+}
+
+void NetworkManager::WireGuardSetting::setMtu(quint32 mtu)
+{
+ Q_D(WireGuardSetting);
+
+ d->mtu = mtu;
+}
+
+bool NetworkManager::WireGuardSetting::peerRoutes() const
+{
+ Q_D(const WireGuardSetting);
+
+ return d->peerRoutes;
+}
+
+void NetworkManager::WireGuardSetting::setPeerRoutes(bool peerRoutes)
+{
+ Q_D(WireGuardSetting);
+
+ d->peerRoutes = peerRoutes;
+}
+
+NMVariantMapList NetworkManager::WireGuardSetting::peers() const
+{
+ Q_D(const WireGuardSetting);
+
+ return d->peers;
+}
+
+void NetworkManager::WireGuardSetting::setPeers(const NMVariantMapList &peers)
+{
+ Q_D(WireGuardSetting);
+
+ d->peers = peers;
+}
+
+QString NetworkManager::WireGuardSetting::privateKey() const
+{
+ Q_D(const WireGuardSetting);
+
+ return d->privateKey;
+}
+
+void NetworkManager::WireGuardSetting::setPrivateKey(const QString &key)
+{
+ Q_D(WireGuardSetting);
+
+ d->privateKey = key;
+}
+
+NetworkManager::Setting::SecretFlags
NetworkManager::WireGuardSetting::privateKeyFlags() const
+{
+ Q_D(const WireGuardSetting);
+
+ return d->privateKeyFlags;
+}
+
+void
NetworkManager::WireGuardSetting::setPrivateKeyFlags(NetworkManager::Setting::SecretFlags
flags)
+{
+ Q_D(WireGuardSetting);
+
+ d->privateKeyFlags = flags;
+}
+
+void NetworkManager::WireGuardSetting::secretsFromMap(const QVariantMap
&secrets)
+{
+ if (secrets.contains(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY))) {
+
setPrivateKey(secrets.value(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY)).toString());
+ }
+
+ if (secrets.contains(QLatin1String(NM_SETTING_WIREGUARD_PEERS))) {
+ NMVariantMapList listOfPeers =
qdbus_cast<NMVariantMapList>(secrets.value(QLatin1String(NM_SETTING_WIREGUARD_PEERS)));
+ NMVariantMapList origPeers = peers();
+
+ for (const QVariantMap &peer : listOfPeers) {
+ if
(peer.contains(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY))) {
+ QString presharedKey =
peer.value(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY)).toString();
+ QString publicKey =
peer.value(QLatin1String(NM_WIREGUARD_PEER_ATTR_PUBLIC_KEY)).toString();
+ for (int i = 0; i < origPeers.size(); i++) {
+ if
(origPeers[i][QLatin1String(NM_WIREGUARD_PEER_ATTR_PUBLIC_KEY)].toString() ==
publicKey) {
+
origPeers[i].insert(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY),
presharedKey);
+ }
+ }
+ }
+ }
+ setPeers(origPeers);
+ }
+}
+
+QVariantMap NetworkManager::WireGuardSetting::secretsToMap() const
+{
+ QVariantMap secrets;
+
+ if (!privateKey().isEmpty()) {
+ secrets.insert(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY),
privateKey());
+ }
+
+ NMVariantMapList peersSecrets;
+
+ for (const QVariantMap &map : peers()) {
+ if (map.contains(QLatin1String(NM_WIREGUARD_PEER_ATTR_PUBLIC_KEY)) &&
map.contains(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY))) {
+ QVariantMap newMap;
+ newMap.insert(QLatin1String(NM_WIREGUARD_PEER_ATTR_PUBLIC_KEY),
map.value(QLatin1String(NM_WIREGUARD_PEER_ATTR_PUBLIC_KEY)));
+ newMap.insert(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY),
map.value(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY)));
+
+ peersSecrets << newMap;
+ }
+ }
+
+ if (!peersSecrets.isEmpty()) {
+ secrets.insert(QLatin1String(NM_SETTING_WIREGUARD_PEERS),
QVariant::fromValue(peersSecrets));
+ }
+
+ return secrets;
+}
+
+void NetworkManager::WireGuardSetting::secretsFromStringMap(const NMStringMap
&map)
+{
+ QVariantMap secretsMap;
+ NMVariantMapList peers;
+
+ auto it = map.constBegin();
+ while (it != map.constEnd()) {
+ if (it.key() == QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY)) {
+ secretsMap.insert(it.key(), it.value());
+ }
+
+ if (it.key().startsWith(QLatin1String(NM_SETTING_WIREGUARD_PEERS)) &&
it.key().endsWith(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY))) {
+ QStringList peerStrList = it.key().split(QLatin1Char('.'));
+
+ QVariantMap peer;
+ peer.insert(QLatin1String(NM_WIREGUARD_PEER_ATTR_PUBLIC_KEY),
peerStrList.at(1));
+ peer.insert(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY),
it.value());
+
+ peers << peer;
+ }
+ ++it;
+ }
+
+ if (!peers.isEmpty()) {
+ secretsMap.insert(QLatin1String(NM_SETTING_WIREGUARD_PEERS),
QVariant::fromValue(peers));
+ }
+
+ secretsFromMap(secretsMap);
+}
+
+NMStringMap NetworkManager::WireGuardSetting::secretsToStringMap() const
+{
+ NMStringMap ret;
+ QVariantMap secretsMap = secretsToMap();
+
+ auto it = secretsMap.constBegin();
+ while (it != secretsMap.constEnd()) {
+ if (it.key() == QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY)) {
+ ret.insert(it.key(), it.value().toString());
+ }
+
+ if (it.key() == QLatin1String(NM_SETTING_WIREGUARD_PEERS)) {
+ NMVariantMapList listOfPeers =
qdbus_cast<NMVariantMapList>(it.value());
+
+ for (const QVariantMap &map : listOfPeers) {
+ const QString str =
QStringLiteral("%1.%2.%3").arg(QLatin1String(NM_SETTING_WIREGUARD_PEERS))
+
.arg(map.value(QLatin1String(NM_WIREGUARD_PEER_ATTR_PUBLIC_KEY)).toString())
+
.arg(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY));
+ ret.insert(str,
map.value(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY)).toString());
+ }
+ }
+ ++it;
+ }
+
+ return ret;
+}
+
+QStringList NetworkManager::WireGuardSetting::needSecrets(bool requestNew)
const
+{
+ QStringList secrets;
+
+ if (!privateKeyFlags().testFlag(Setting::NotRequired)) {
+ if (privateKey().isEmpty() || requestNew) {
+ secrets << QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY);
+ }
+ }
+
+ for (const QVariantMap &map : peers()) {
+ const QString presharedKey =
map.value(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY)).toString();
+ SecretFlags preSharedKeyFlags = (SecretFlags)
map.value(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY_FLAGS)).toInt();
+
+ if (!presharedKey.isEmpty()) {
+ continue;
+ }
+
+ if (preSharedKeyFlags.testFlag(Setting::NotRequired)) {
+ continue;
+ }
+
+ if (secrets.isEmpty()) {
+ const QString str =
QStringLiteral("%1.%2.%3").arg(QLatin1String(NM_SETTING_WIREGUARD_PEERS))
+
.arg(map.value(QLatin1String(NM_WIREGUARD_PEER_ATTR_PUBLIC_KEY)).toString())
+
.arg(QLatin1String(NM_WIREGUARD_PEER_ATTR_PRESHARED_KEY));
+ secrets << str;
+ }
+ }
+
+ return secrets;
+}
+
+void NetworkManager::WireGuardSetting::fromMap(const QVariantMap &setting)
+{
+ if (setting.contains(QLatin1String(NM_SETTING_WIREGUARD_FWMARK))) {
+
setFwmark(setting.value(QLatin1String(NM_SETTING_WIREGUARD_FWMARK)).toInt());
+ }
+
+ if (setting.contains(QLatin1String(NM_SETTING_WIREGUARD_LISTEN_PORT))) {
+
setListenPort(setting.value(QLatin1String(NM_SETTING_WIREGUARD_LISTEN_PORT)).toInt());
+ }
+
+ if (setting.contains(QLatin1String(NM_SETTING_WIREGUARD_MTU))) {
+ setMtu(setting.value(QLatin1String(NM_SETTING_WIREGUARD_MTU)).toInt());
+ }
+
+ if (setting.contains(QLatin1String(NM_SETTING_WIREGUARD_PEER_ROUTES))) {
+
setPeerRoutes(setting.value(QLatin1String(NM_SETTING_WIREGUARD_PEER_ROUTES)).toBool());
+ }
+
+ if (setting.contains(QLatin1String(NM_SETTING_WIREGUARD_PEERS))) {
+
setPeers(qdbus_cast<NMVariantMapList>(setting.value(QLatin1String(NM_SETTING_WIREGUARD_PEERS))));
+ }
+
+ if (setting.contains(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY))) {
+
setPrivateKey(setting.value(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY)).toString());
+ }
+
+ if
(setting.contains(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS))) {
+
setPrivateKeyFlags((SecretFlags)setting.value(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS)).toInt());
+ }
+}
+
+QVariantMap NetworkManager::WireGuardSetting::toMap() const
+{
+ QVariantMap setting;
+
+ setting.insert(QLatin1String(NM_SETTING_WIREGUARD_FWMARK), fwmark());
+ setting.insert(QLatin1String(NM_SETTING_WIREGUARD_LISTEN_PORT),
listenPort());
+ setting.insert(QLatin1String(NM_SETTING_WIREGUARD_MTU), mtu());
+ setting.insert(QLatin1String(NM_SETTING_WIREGUARD_PEER_ROUTES),
peerRoutes());
+
+ if (!peers().isEmpty()) {
+ setting.insert(QLatin1String(NM_SETTING_WIREGUARD_PEERS),
QVariant::fromValue(peers()));
+ }
+
+ if (!privateKey().isEmpty()) {
+ setting.insert(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY),
privateKey());
+ setting.insert(QLatin1String(NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS),
(int)privateKeyFlags());
+ }
+
+ return setting;
+}
+
+QDebug NetworkManager::operator <<(QDebug dbg, const
NetworkManager::WireGuardSetting &setting)
+{
+ dbg.nospace() << "type: " << setting.typeAsString(setting.type()) << '\n';
+ dbg.nospace() << "initialized: " << !setting.isNull() << '\n';
+
+ dbg.nospace() << NM_SETTING_WIREGUARD_FWMARK << ": " << setting.fwmark()
<< '\n';
+ dbg.nospace() << NM_SETTING_WIREGUARD_LISTEN_PORT << ": " <<
setting.listenPort() << '\n';
+ dbg.nospace() << NM_SETTING_WIREGUARD_MTU << ": " << setting.mtu() << '\n';
+ dbg.nospace() << NM_SETTING_WIREGUARD_PEER_ROUTES << ": " <<
setting.peerRoutes() << '\n';
+ dbg.nospace() << NM_SETTING_WIREGUARD_PEERS << ": " << setting.peers() <<
'\n';
+ dbg.nospace() << NM_SETTING_WIREGUARD_PRIVATE_KEY << ": " <<
setting.privateKey() << '\n';
+ dbg.nospace() << NM_SETTING_WIREGUARD_PRIVATE_KEY_FLAGS << ": " <<
setting.privateKeyFlags() << '\n';
+
+ return dbg.maybeSpace();
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/src/settings/wireguardsetting.h
new/networkmanager-qt-5.57.0/src/settings/wireguardsetting.h
--- old/networkmanager-qt-5.56.0/src/settings/wireguardsetting.h
1970-01-01 01:00:00.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/settings/wireguardsetting.h
2019-04-07 09:21:21.000000000 +0200
@@ -0,0 +1,99 @@
+/*
+ Copyright 2019 Jan Grulich <jgrulich@xxxxxxxxxx>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see
<http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NETWORKMANAGERQT_WIREGUARD_SETTING_H
+#define NETWORKMANAGERQT_WIREGUARD_SETTING_H
+
+#include <networkmanagerqt/networkmanagerqt_export.h>
+#include "setting.h"
+
+#include <QString>
+
+namespace NetworkManager
+{
+
+class WireGuardSettingPrivate;
+
+/**
+ * Represents generic setting
+ */
+class NETWORKMANAGERQT_EXPORT WireGuardSetting : public Setting
+{
+public:
+ typedef QSharedPointer<WireGuardSetting> Ptr;
+ typedef QList<Ptr> List;
+ WireGuardSetting();
+ explicit WireGuardSetting(const Ptr &other);
+ ~WireGuardSetting() override;
+
+ QString name() const override;
+
+ quint32 fwmark() const;
+ void setFwmark(quint32 fwmark);
+
+ quint32 listenPort() const;
+ void setListenPort(quint32 port);
+
+ quint32 mtu() const;
+ void setMtu(quint32 mtu);
+
+ bool peerRoutes() const;
+ void setPeerRoutes(bool peerRoutes);
+
+ NMVariantMapList peers() const;
+ void setPeers(const NMVariantMapList &peers);
+
+ QString privateKey() const;
+ void setPrivateKey(const QString &key);
+
+ SecretFlags privateKeyFlags() const;
+ void setPrivateKeyFlags(SecretFlags flags);
+
+ void secretsFromMap(const QVariantMap &secrets) override;
+
+ QVariantMap secretsToMap() const override;
+
+ void secretsFromStringMap(const NMStringMap &map) override;
+
+ NMStringMap secretsToStringMap() const override;
+
+ /*
+ * Required "preshared-key" properties from "peers" property will be
returned
+ * as strings in format "peers.public-key.preshared-key".
+ */
+ QStringList needSecrets(bool requestNew = false) const override;
+
+ void fromMap(const QVariantMap &setting) override;
+
+ QVariantMap toMap() const override;
+
+protected:
+ WireGuardSettingPrivate *d_ptr;
+
+private:
+ Q_DECLARE_PRIVATE(WireGuardSetting)
+};
+
+NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const WireGuardSetting
&setting);
+
+}
+
+#endif // NETWORKMANAGERQT_WIREGUARD_SETTING_H
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/src/settings/wireguardsetting_p.h
new/networkmanager-qt-5.57.0/src/settings/wireguardsetting_p.h
--- old/networkmanager-qt-5.56.0/src/settings/wireguardsetting_p.h
1970-01-01 01:00:00.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/settings/wireguardsetting_p.h
2019-04-07 09:21:21.000000000 +0200
@@ -0,0 +1,48 @@
+/*
+ Copyright 2019 Jan Grulich <jgrulich@xxxxxxxxxx>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) version 3, or any
+ later version accepted by the membership of KDE e.V. (or its
+ successor approved by the membership of KDE e.V.), which shall
+ act as a proxy defined in Section 6 of version 3 of the license.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see
<http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NETWORKMANAGERQT_WIREGUARD_SETTING_P_H
+#define NETWORKMANAGERQT_WIREGUARD_SETTING_P_H
+
+#include <QString>
+
+namespace NetworkManager
+{
+
+class WireGuardSettingPrivate
+{
+public:
+ WireGuardSettingPrivate();
+
+ QString name;
+
+ quint32 fwmark;
+ quint32 listenPort;
+ quint32 mtu;
+ bool peerRoutes;
+ NMVariantMapList peers;
+ QString privateKey;
+ NetworkManager::Setting::SecretFlags privateKeyFlags;
+};
+
+}
+
+#endif // NETWORKMANAGERQT_WIREGUARD_SETTING_P_H
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/networkmanager-qt-5.56.0/src/settings/wirelesssecuritysetting.cpp
new/networkmanager-qt-5.57.0/src/settings/wirelesssecuritysetting.cpp
--- old/networkmanager-qt-5.56.0/src/settings/wirelesssecuritysetting.cpp
2019-03-02 14:30:50.000000000 +0100
+++ new/networkmanager-qt-5.57.0/src/settings/wirelesssecuritysetting.cpp
2019-04-07 09:21:21.000000000 +0200
@@ -40,7 +40,7 @@
{ }

NetworkManager::WirelessSecuritySetting::WirelessSecuritySetting(const Ptr
&other)
- : Setting(Setting::WirelessSecurity)
+ : Setting(other)
, d_ptr(new WirelessSecuritySettingPrivate())
{
setKeyMgmt(other->keyMgmt());


< Previous Next >
This Thread
  • No further messages