53 lines
2.3 KiB
Diff
53 lines
2.3 KiB
Diff
From 0d0b3c2403abd618b6f664f9e21b0ed8672b852b Mon Sep 17 00:00:00 2001
|
|
From: luoqing <luoqing@kylinsec.com.cn>
|
|
Date: Thu, 5 Jan 2023 13:48:58 +0800
|
|
Subject: [PATCH] fix(network):Fix the problem that the network settings of the
|
|
control center, clone MAC address settings, can't be saved after being
|
|
modified and cleared
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
- 修复控制中心网络设置克隆MAC地址设置保存之后,再修改清空,保存无法保存的问题
|
|
---
|
|
.../plugin/setting-widget/ethernet-widget.cpp | 22 ++++++++++++++++++-
|
|
1 file changed, 21 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp b/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
|
|
index af438bf..9d5dfe7 100644
|
|
--- a/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
|
|
+++ b/plugins/network/src/plugin/setting-widget/ethernet-widget.cpp
|
|
@@ -89,8 +89,28 @@ void EthernetWidget::saveSettings()
|
|
QString cloneMac = ui->cloneDeviceMac->text();
|
|
KLOG_DEBUG() << "macAddress:" << macAddress;
|
|
KLOG_DEBUG() << "cloneMac:" << cloneMac;
|
|
+
|
|
m_wiredSetting->setMacAddress(QByteArray::fromHex(macAddress.toUtf8()));
|
|
- m_wiredSetting->setClonedMacAddress(QByteArray::fromHex(cloneMac.toUtf8()));
|
|
+
|
|
+ if(cloneMac.isEmpty())
|
|
+ {
|
|
+ /**
|
|
+ * assigned-mac-address:
|
|
+ * The new field for the cloned MAC address.
|
|
+ * It can be either a hardware address in ASCII representation,
|
|
+ * or one of the special values "preserve", "permanent", "random" or "stable".
|
|
+ * This field replaces the deprecated "cloned-mac-address" on D-Bus,
|
|
+ * which can only contain explicit hardware addresses.
|
|
+ * 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->setClonedMacAddress(QByteArray());
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ m_wiredSetting->setClonedMacAddress(QByteArray::fromHex(cloneMac.toUtf8()));
|
|
+ }
|
|
m_wiredSetting->setMtu(ui->customMTU->value());
|
|
}
|
|
}
|
|
--
|
|
2.33.0
|
|
|