From 67a53c83fa016cef9202d51b5f52139ee297c1fc Mon Sep 17 00:00:00 2001 From: re2zero Date: Thu, 23 Apr 2026 16:50:05 +0800 Subject: [PATCH 1/2] fix: expand virtual interface filtering criteria in getFirstIp Refactor the virtual interface detection logic into a dedicated function and add checks for additional virtual interfaces (e.g., veth, br-, VMware, VirtualBox, Hyper-V, Bluetooth) based on both name and human-readable name. This improves IP address retrieval by more accurately skipping virtual network interfaces. --- src/common/commonutils.cpp | 30 ++++++++++++++++++++++++------ src/compat/common/commonutils.cpp | 28 +++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/common/commonutils.cpp b/src/common/commonutils.cpp index a723e9688..4fce23c57 100644 --- a/src/common/commonutils.cpp +++ b/src/common/commonutils.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -24,6 +24,27 @@ using namespace deepin_cross; #define WEB_MIN_PORT 13628 #define WEB_MAX_PORT 23628 +static bool isVirtualInterface(const QNetworkInterface &netInterface) +{ + QString name = netInterface.name().toLower(); + if (name.startsWith("virbr") || name.startsWith("vmnet") + || name.startsWith("docker") || name.startsWith("veth") + || name.startsWith("br-")) { + qInfo() << "Filtering virtual interface (by name):" << netInterface.name(); + return true; + } + + QString humanName = netInterface.humanReadableName().toLower(); + if (humanName.contains("vmware") || humanName.contains("virtualbox") + || humanName.contains("hyper-v") || humanName.contains("virtual ethernet") + || humanName.contains("vethernet") || humanName.contains("bluetooth")) { + qInfo() << "Filtering virtual interface (by humanReadableName):" << netInterface.humanReadableName(); + return true; + } + + return false; +} + std::string CommonUitls::getFirstIp() { qInfo() << "Getting first available IP address"; @@ -38,10 +59,7 @@ std::string CommonUitls::getFirstIp() continue; } - if (netInterface.name().startsWith("virbr") || netInterface.name().startsWith("vmnet") - || netInterface.name().startsWith("docker")) { - // 跳过桥接,虚拟机和docker的网络接口 - qInfo() << "netInterface name:" << netInterface.name(); + if (isVirtualInterface(netInterface)) { continue; } @@ -52,7 +70,7 @@ std::string CommonUitls::getFirstIp() if (entry.ip().protocol() == QAbstractSocket::IPv4Protocol && entry.ip() != QHostAddress::LocalHost) { //IP地址 ip = QString(entry.ip().toString()); - qInfo() << "Found available IP: " << ip; + qInfo() << "Found available IP: " << ip << "on interface:" << netInterface.name(); return ip.toStdString(); } } diff --git a/src/compat/common/commonutils.cpp b/src/compat/common/commonutils.cpp index 200a5e7d5..6c04cba5f 100644 --- a/src/compat/common/commonutils.cpp +++ b/src/compat/common/commonutils.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -23,6 +23,27 @@ static constexpr char kApp1[] { "dde-cooperation" }; static constexpr char kApp2[] { "deepin-data-transfer" }; static constexpr char kDaemon[] { "cooperation-daemon" }; +static bool isVirtualInterface(const QNetworkInterface &netInterface) +{ + QString name = netInterface.name().toLower(); + if (name.startsWith("virbr") || name.startsWith("vmnet") + || name.startsWith("docker") || name.startsWith("veth") + || name.startsWith("br-")) { + qInfo() << "Filtering virtual interface (by name):" << netInterface.name(); + return true; + } + + QString humanName = netInterface.humanReadableName().toLower(); + if (humanName.contains("vmware") || humanName.contains("virtualbox") + || humanName.contains("hyper-v") || humanName.contains("virtual ethernet") + || humanName.contains("vethernet") || humanName.contains("bluetooth")) { + qInfo() << "Filtering virtual interface (by humanReadableName):" << netInterface.humanReadableName(); + return true; + } + + return false; +} + std::string CommonUitls::getFirstIp() { QString ip; @@ -35,10 +56,7 @@ std::string CommonUitls::getFirstIp() continue; } - if (netInterface.name().startsWith("virbr") || netInterface.name().startsWith("vmnet") - || netInterface.name().startsWith("docker")) { - // 跳过桥接,虚拟机和docker的网络接口 - qInfo() << "netInterface name:" << netInterface.name(); + if (isVirtualInterface(netInterface)) { continue; } From 69e62b3dcaaf615264dee7867442866b5ff8f905 Mon Sep 17 00:00:00 2001 From: re2zero Date: Thu, 23 Apr 2026 16:50:56 +0800 Subject: [PATCH 2/2] chore: update version to 1.2.3 - bump version to 1.2.3 Log : bump version to 1.2.3 --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9bbe80ab4..254272eda 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +dde-cooperation (1.2.3) unstable; urgency=medium + + * chore: Update version to 1.2.3 + * fix(network): filter virtual network interfaces correctly on Windows + * fix: add PNG/JPEG to BMP DIB conversion for X11 clipboard + + -- re2zero Thu, 23 Apr 2026 16:42:52 +0800 + dde-cooperation (1.2.2) unstable; urgency=medium * fix(log): remove duplicate qCritical logs