fix(network):Fix the issue of ineffective cloning of MAC addresses, compatible with the lower version of kf5 networkmanager qt5
- 修复控制中心网络设置克隆MAC地址设置保存之后,再修改清空,清空克隆MAC地址不生效的问题,同时兼容低版本的kf5-networkmanager-qt5
This commit is contained in:
parent
bc8a4b0f4a
commit
ee3305b5c4
@ -0,0 +1,68 @@
|
||||
From 20bce602db4eae6cb6d21429054916dbc8393113 Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Wed, 26 Apr 2023 14:12:21 +0800
|
||||
Subject: [PATCH] fix(network):Fix the issue of ineffective cloning of MAC
|
||||
addresses after saving the network settings of the control center, and then
|
||||
modify and clear them. It is also compatible with the lower version of kf5
|
||||
networkmanager qt5
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复控制中心网络设置克隆MAC地址设置保存之后,再修改清空,清空克隆MAC地址不生效的问题,同时兼容低版本的kf5-networkmanager-qt5
|
||||
---
|
||||
.../plugin/setting-widget/ethernet-widget.cpp | 2 +-
|
||||
.../src/plugin/settings/setting-page.cpp | 23 +++++++++++++++++--
|
||||
2 files changed, 22 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp b/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
|
||||
index 9d5dfe7..7e09a54 100644
|
||||
--- a/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
|
||||
+++ b/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
|
||||
@@ -104,7 +104,7 @@ void EthernetWidget::saveSettings()
|
||||
* Note that this property only exists in D-Bus API.
|
||||
* libnm and nmcli continue to call this property "cloned-mac-address".
|
||||
*/
|
||||
- m_wiredSetting->setAssignedMacAddress(QString());
|
||||
+ // m_wiredSetting->setAssignedMacAddress(QString());
|
||||
m_wiredSetting->setClonedMacAddress(QByteArray());
|
||||
}
|
||||
else
|
||||
diff --git a/plugins/network/src/plugin/settings/setting-page.cpp b/plugins/network/src/plugin/settings/setting-page.cpp
|
||||
index 464e646..3aa9201 100644
|
||||
--- a/plugins/network/src/plugin/settings/setting-page.cpp
|
||||
+++ b/plugins/network/src/plugin/settings/setting-page.cpp
|
||||
@@ -96,9 +96,28 @@ void SettingPage::handleSaveButtonClicked(ConnectionSettings::ConnectionType con
|
||||
else
|
||||
{
|
||||
saveSettingPage();
|
||||
- //只有无线网络使用自定义settingUpdated信号,因为未连接无线网络前不存在本地Setting,无法在初始化时监听信号
|
||||
+ // 只有无线网络使用自定义settingUpdated信号,因为未连接无线网络前不存在本地Setting,无法在初始化时监听信号
|
||||
connect(m_connection.data(), &NetworkManager::Connection::updated, this, &SettingPage::settingUpdated, Qt::UniqueConnection);
|
||||
- QDBusPendingReply<> replyUpdate = m_connection->update(m_connectionSettings->toMap());
|
||||
+ /**
|
||||
+ * NOTE:
|
||||
+ * 这里是为了修复控制中心网络设置克隆MAC地址设置保存之后,再修改清空,清空克隆MAC地址不生效的问题,同时兼容低版本的kf5-networkmanager-qt5
|
||||
+ * 问题原因:高版本的NetworkManager成功设置克隆MAC地址后会有,两个属性:assigned-mac-addres (新属性),cloned-mac-address(即将被废弃)
|
||||
+ * 两个属性作用是一样的,低版本的kf5-networkmanager-qt5只有对cloned-mac-address(即将被废弃)进行设置的接口,
|
||||
+ * 无法对assigned-mac-addres(新属性)进行操作。需要将这个两个属性都清空才能清空克隆MAC地址
|
||||
+ * 因此这里手动将assigned-mac-addres相关的设置进行清空。
|
||||
+ */
|
||||
+ NMVariantMapMap settingsMap = m_connectionSettings->toMap();
|
||||
+ if (settingsMap.contains("802-3-ethernet"))
|
||||
+ {
|
||||
+ QVariantMap varMap = settingsMap.value("802-3-ethernet");
|
||||
+ if (!varMap.contains("cloned-mac-address") && varMap.contains("assigned-mac-address"))
|
||||
+ {
|
||||
+ varMap.remove("assigned-mac-address");
|
||||
+ settingsMap.insert("802-3-ethernet", varMap);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ QDBusPendingReply<> replyUpdate = m_connection->update(settingsMap);
|
||||
replyUpdate.waitForFinished();
|
||||
if (replyUpdate.isError())
|
||||
{
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: kiran-control-panel
|
||||
Version: 2.5.0
|
||||
Release: 3
|
||||
Release: 4
|
||||
Summary: Kiran Control Panel
|
||||
Summary(zh_CN): Kiran桌面控制面板
|
||||
|
||||
@ -10,6 +10,7 @@ Patch0: 0001-fix-translate-add-some-translation.patch
|
||||
Patch1: 0001-fix-icon-add-KiranNew-icon-selector-in-ui.patch
|
||||
Patch2: 0002-feature-options.cmake-Add-compilation-option-switch-.patch
|
||||
Patch3: 0003-fix-Compatible-for-versions-below-5.14.patch
|
||||
Patch4: 0001-fix-network-Fix-the-issue-of-ineffective-cloning-of-.patch
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: cmake >= 3.2
|
||||
@ -159,6 +160,9 @@ make %{?_smp_mflags}
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%changelog
|
||||
* Wed Apr 26 2023 luoqing <luoqing@kylinsec.om.cn> - 2.5.0-4
|
||||
- KYOS-F: Fix the issue of ineffective cloning of MAC addresses, compatible with the lower version of kf5 networkmanager qt5
|
||||
|
||||
* Sun Apr 23 2023 wangyucheng <wangyucheng@kylinsec.om.cn> - 2.5.0-3
|
||||
- KYOS-F: Compatible for versions below 5.14
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user