From af369ea9bd610a23e49a4ef424c28204aa22d68d Mon Sep 17 00:00:00 2001 From: Silke Hofstra Date: Sun, 8 Sep 2024 19:10:12 +0200 Subject: [PATCH] kdeconnect: Disable built-in mDNS announce **Summary** Disable built-in mDNS announce as it conflicts with Avahi or systemd-resolved. Provide a systemd-resolved service definition so Solus devices can still be discovered. --- packages/k/kdeconnect/abi_symbols | 4 +- ...01-Allow-disabling-of-mDNS-announcer.patch | 123 ++++++++++++++++++ packages/k/kdeconnect/files/kdeconnect.dnssd | 4 + .../k/kdeconnect/files/openssh-8.2-fix.patch | 12 -- packages/k/kdeconnect/files/series | 12 +- packages/k/kdeconnect/package.yml | 14 +- packages/k/kdeconnect/pspec_x86_64.xml | 13 +- 7 files changed, 148 insertions(+), 34 deletions(-) create mode 100644 packages/k/kdeconnect/files/0001-Allow-disabling-of-mDNS-announcer.patch create mode 100644 packages/k/kdeconnect/files/kdeconnect.dnssd delete mode 100644 packages/k/kdeconnect/files/openssh-8.2-fix.patch diff --git a/packages/k/kdeconnect/abi_symbols b/packages/k/kdeconnect/abi_symbols index 92ad5ab661c..8850ca8fc51 100644 --- a/packages/k/kdeconnect/abi_symbols +++ b/packages/k/kdeconnect/abi_symbols @@ -124,8 +124,8 @@ libkdeconnectcore.so.24:_ZN13MdnsDiscovery15onNetworkChangeEv libkdeconnectcore.so.24:_ZN13MdnsDiscovery16staticMetaObjectE libkdeconnectcore.so.24:_ZN13MdnsDiscovery6onStopEv libkdeconnectcore.so.24:_ZN13MdnsDiscovery7onStartEv -libkdeconnectcore.so.24:_ZN13MdnsDiscoveryC1EP15LanLinkProvider -libkdeconnectcore.so.24:_ZN13MdnsDiscoveryC2EP15LanLinkProvider +libkdeconnectcore.so.24:_ZN13MdnsDiscoveryC1EP15LanLinkProviderb +libkdeconnectcore.so.24:_ZN13MdnsDiscoveryC2EP15LanLinkProviderb libkdeconnectcore.so.24:_ZN13MdnsDiscoveryD0Ev libkdeconnectcore.so.24:_ZN13MdnsDiscoveryD1Ev libkdeconnectcore.so.24:_ZN13MdnsDiscoveryD2Ev diff --git a/packages/k/kdeconnect/files/0001-Allow-disabling-of-mDNS-announcer.patch b/packages/k/kdeconnect/files/0001-Allow-disabling-of-mDNS-announcer.patch new file mode 100644 index 00000000000..50661a856b0 --- /dev/null +++ b/packages/k/kdeconnect/files/0001-Allow-disabling-of-mDNS-announcer.patch @@ -0,0 +1,123 @@ +From 1005b8157c2060ef5d97aef39085c6b6be2bdda3 Mon Sep 17 00:00:00 2001 +From: Silke Hofstra +Date: Sun, 8 Sep 2024 21:13:33 +0200 +Subject: [PATCH] Allow disabling of mDNS announcer + +Add a CMAKE flag to allow for disabling the mDNS announcer. +This allows for KDE connect to run next to existing announcers like Avahi and Systemd Resolved. +--- + core/CMakeLists.txt | 4 ++++ + core/backends/lan/lanlinkprovider.cpp | 6 +++++- + core/backends/lan/mdnsdiscovery.cpp | 15 +++++++++++---- + core/backends/lan/mdnsdiscovery.h | 3 ++- + 4 files changed, 22 insertions(+), 6 deletions(-) + +diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt +index 613c738d..2d788c6d 100644 +--- a/core/CMakeLists.txt ++++ b/core/CMakeLists.txt +@@ -8,6 +8,7 @@ set(KDECONNECT_PRIVATE_DBUS_NAME DBusKDEConnectOnly) + configure_file(dbushelper.h.in ${CMAKE_CURRENT_BINARY_DIR}/dbushelper.h) + + option(MDNS_ENABLED "Use MDNS for device discovery" ON) ++option(MDNS_ANNOUNCE "Enable the mDNS announcer" ON) + + add_subdirectory(backends/lan) + add_subdirectory(backends/loopback) +@@ -83,6 +84,9 @@ endif() + + if (MDNS_ENABLED) + target_compile_definitions(kdeconnectcore PRIVATE -DKDECONNECT_MDNS) ++ if (MDNS_ANNOUNCE) ++ target_compile_definitions(kdeconnectcore PRIVATE -DKDECONNECT_MDNS_ANNOUNCE) ++ endif() + endif() + + set_target_properties(kdeconnectcore PROPERTIES +diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp +index 292adffd..b034917a 100644 +--- a/core/backends/lan/lanlinkprovider.cpp ++++ b/core/backends/lan/lanlinkprovider.cpp +@@ -49,7 +49,11 @@ LanLinkProvider::LanLinkProvider(bool testMode) + , m_testMode(testMode) + , m_combineNetworkChangeTimer(this) + #ifdef KDECONNECT_MDNS +- , m_mdnsDiscovery(this) ++#ifdef MDNS_ANNOUNCE ++ , m_mdnsDiscovery(this, true) ++#else ++ , m_mdnsDiscovery(this, false) ++#endif + #endif + { + m_combineNetworkChangeTimer.setInterval(0); // increase this if waiting a single event-loop iteration is not enough +diff --git a/core/backends/lan/mdnsdiscovery.cpp b/core/backends/lan/mdnsdiscovery.cpp +index 43acb5b4..2a59ed04 100644 +--- a/core/backends/lan/mdnsdiscovery.cpp ++++ b/core/backends/lan/mdnsdiscovery.cpp +@@ -14,10 +14,11 @@ + + const QString kServiceType = QStringLiteral("_kdeconnect._udp.local"); + +-MdnsDiscovery::MdnsDiscovery(LanLinkProvider *lanLinkProvider) ++MdnsDiscovery::MdnsDiscovery(LanLinkProvider *lanLinkProvider, bool announce) + : mdnsAnnouncer(KdeConnectConfig::instance().deviceId(), kServiceType, LanLinkProvider::UDP_PORT) + { + KdeConnectConfig &config = KdeConnectConfig::instance(); ++ m_announce = announce; + mdnsAnnouncer.putTxtRecord(QStringLiteral("id"), config.deviceId()); + mdnsAnnouncer.putTxtRecord(QStringLiteral("name"), config.name()); + mdnsAnnouncer.putTxtRecord(QStringLiteral("type"), config.deviceType().toString()); +@@ -40,19 +41,25 @@ MdnsDiscovery::~MdnsDiscovery() + + void MdnsDiscovery::onStart() + { +- mdnsAnnouncer.startAnnouncing(); ++ if (m_announce) { ++ mdnsAnnouncer.startAnnouncing(); ++ } + mdnsDiscoverer.startDiscovering(kServiceType); + } + + void MdnsDiscovery::onStop() + { +- mdnsAnnouncer.stopAnnouncing(); ++ if (m_announce) { ++ mdnsAnnouncer.stopAnnouncing(); ++ } + mdnsDiscoverer.stopDiscovering(); + } + + void MdnsDiscovery::onNetworkChange() + { +- mdnsAnnouncer.onNetworkChange(); ++ if (m_announce) { ++ mdnsAnnouncer.onNetworkChange(); ++ } + mdnsDiscoverer.stopDiscovering(); + mdnsDiscoverer.startDiscovering(kServiceType); + } +diff --git a/core/backends/lan/mdnsdiscovery.h b/core/backends/lan/mdnsdiscovery.h +index f48cb00c..4a964676 100644 +--- a/core/backends/lan/mdnsdiscovery.h ++++ b/core/backends/lan/mdnsdiscovery.h +@@ -20,7 +20,7 @@ class KDECONNECTCORE_EXPORT MdnsDiscovery : public QObject + Q_OBJECT + + public: +- explicit MdnsDiscovery(LanLinkProvider *parent); ++ explicit MdnsDiscovery(LanLinkProvider *parent, bool announce); + ~MdnsDiscovery(); + + void onStart(); +@@ -30,6 +30,7 @@ public Q_SLOTS: + void onNetworkChange(); + + private: ++ bool m_announce; + MdnsWrapper::Discoverer mdnsDiscoverer; + MdnsWrapper::Announcer mdnsAnnouncer; + }; +-- +2.47.0 + diff --git a/packages/k/kdeconnect/files/kdeconnect.dnssd b/packages/k/kdeconnect/files/kdeconnect.dnssd new file mode 100644 index 00000000000..3ace8085ea2 --- /dev/null +++ b/packages/k/kdeconnect/files/kdeconnect.dnssd @@ -0,0 +1,4 @@ +[Service] +Name=%H +Type=_kdeconnect._udp +TxtText=type=desktop diff --git a/packages/k/kdeconnect/files/openssh-8.2-fix.patch b/packages/k/kdeconnect/files/openssh-8.2-fix.patch deleted file mode 100644 index ff067aa8eb9..00000000000 --- a/packages/k/kdeconnect/files/openssh-8.2-fix.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/plugins/sftp/mounter.cpp b/plugins/sftp/mounter.cpp -index fca9907c..f673c9f7 100644 ---- a/plugins/sftp/mounter.cpp -+++ b/plugins/sftp/mounter.cpp -@@ -145,6 +145,7 @@ void Mounter::onPackageReceived(const NetworkPacket& np) - << QStringLiteral("-o") << QStringLiteral("reconnect") - << QStringLiteral("-o") << QStringLiteral("ServerAliveInterval=30") - << QStringLiteral("-o") << QStringLiteral("password_stdin") -+ << QStringLiteral("-o") << QStringLiteral("KexAlgorithms=+diffie-hellman-group14-sha1") - ; - - m_proc->setProgram(program, arguments); diff --git a/packages/k/kdeconnect/files/series b/packages/k/kdeconnect/files/series index 1b2096376f8..42a4cd370e6 100644 --- a/packages/k/kdeconnect/files/series +++ b/packages/k/kdeconnect/files/series @@ -1,11 +1 @@ -0001-do-not-ignore-ssl-errors.patch -0002-do-not-leak-local-user.patch -0003-fix-use-after-free-in-lanlink.patch -0004-limit-identity-packets.patch -0005-do-not-let-lanlink-connections-stay-open.patch -0006-dont-brute-force-reading-the-socket.patch -0007-limit-number-of-connected-sockets.patch -0008-do-not-remember-more-than-a-few-identity-packets.patch -0009-limit-the-ports.patch -0010-do-not-replace-connections.patch -openssh-8.2-fix.patch +0001-Allow-disabling-of-mDNS-announcer.patch diff --git a/packages/k/kdeconnect/package.yml b/packages/k/kdeconnect/package.yml index bc551da5033..48ae568ce4b 100644 --- a/packages/k/kdeconnect/package.yml +++ b/packages/k/kdeconnect/package.yml @@ -1,6 +1,6 @@ name : kdeconnect version : 24.08.2 -release : 79 +release : 80 source : - https://download.kde.org/stable/release-service/24.08.2/src/kdeconnect-kde-24.08.2.tar.xz : d7178d96b445ef660923f305a90fc6aecccae4049cc99a39ee6c17ac0bf51c69 homepage : https://kdeconnect.kde.org/ @@ -44,14 +44,22 @@ optimize : - speed - thin-lto setup : | - # https://bugs.kde.org/show_bug.cgi?id=481870 - %cmake_kf6 -DBLUETOOTH_ENABLED=OFF + %apply_patches + # Bluetooth: https://bugs.kde.org/show_bug.cgi?id=481870 + # mDNS: https://bugs.kde.org/show_bug.cgi?id=487719 + # https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/720 + %cmake_kf6 \ + -DBLUETOOTH_ENABLED=OFF \ + -DMDNS_ANNOUNCE=OFF build : | %ninja_build install : | %ninja_install %qml6_cache + # Install mDNS service definition for autodiscovery + install -Dm0644 -t $installdir/usr/lib/systemd/dnssd $pkgfiles/*.dnssd + # remove doc rm -rfv $installdir/usr/share/doc diff --git a/packages/k/kdeconnect/pspec_x86_64.xml b/packages/k/kdeconnect/pspec_x86_64.xml index 634023b926e..5c1b51d9c12 100644 --- a/packages/k/kdeconnect/pspec_x86_64.xml +++ b/packages/k/kdeconnect/pspec_x86_64.xml @@ -3,8 +3,8 @@ kdeconnect https://kdeconnect.kde.org/ - Reilly Brogan - solus@reillybrogan.com + Silke Hofstra + silke@slxh.eu GPL-2.0-or-later desktop.kde @@ -27,6 +27,7 @@ /usr/bin/kdeconnect-settings /usr/bin/kdeconnect-sms /usr/bin/kdeconnectd + /usr/lib/systemd/dnssd/kdeconnect.dnssd /usr/lib64/libkdeconnectcore.so.24 /usr/lib64/libkdeconnectcore.so.24.08.2 /usr/lib64/libkdeconnectpluginkcm.so.24 @@ -932,12 +933,12 @@ - - 2024-10-19 + + 2024-10-24 24.08.2 Packaging update - Reilly Brogan - solus@reillybrogan.com + Silke Hofstra + silke@slxh.eu \ No newline at end of file