Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch mdns resolver #3767

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions packages/a/avahi/package.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name : avahi

Check notice on line 1 in packages/a/avahi/package.yml

View workflow job for this annotation

GitHub Actions / Checks

This package is included in the ISO. Consider validating the functionality in a newly built ISO.
version : '0.8'
release : 27
release : 28
source :
# - https://github.com/avahi/avahi/archive/refs/tags/v0.8.tar.gz : c15e750ef7c6df595fb5f2ce10cac0fee2353649600e6919ad08ae8871e4945f
# Use git source until v0.9 releases:
Expand Down Expand Up @@ -53,13 +53,6 @@

install -D -m 00644 $pkgfiles/avahi.sysusers $installdir%libdir%/sysusers.d/avahi.conf
install -D -m 00644 $pkgfiles/avahi.tmpfiles $installdir%libdir%/tmpfiles.d/avahi.conf

# Pre-enable
install -D -d -m 00755 $installdir/%libdir%/systemd/system/sockets.target.wants
install -D -d -m 00755 $installdir/%libdir%/systemd/system/multi-user.target.wants
ln -sv ../avahi-daemon.socket -t $installdir/%libdir%/systemd/system/sockets.target.wants
ln -sv avahi-daemon.service $installdir/%libdir%/systemd/system/dbus-org.freedesktop.Avahi.service
ln -sv ../avahi-daemon.service $installdir/%libdir%/systemd/system/multi-user.target.wants/avahi-daemon.service
else
rm -rfv $installdir/%libdir%/systemd
fi
Expand Down
27 changes: 12 additions & 15 deletions packages/a/avahi/pspec_x86_64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<Name>avahi</Name>
<Homepage>https://www.avahi.org/</Homepage>
<Packager>
<Name>Reilly Brogan</Name>
<Email>[email protected]</Email>
<Name>Silke Hofstra</Name>
<Email>[email protected]</Email>
</Packager>
<License>LGPL-2.1-or-later</License>
<PartOf>desktop.core</PartOf>
Expand Down Expand Up @@ -52,9 +52,6 @@
<Path fileType="library">/usr/lib64/systemd/system/avahi-daemon.service</Path>
<Path fileType="library">/usr/lib64/systemd/system/avahi-daemon.socket</Path>
<Path fileType="library">/usr/lib64/systemd/system/avahi-dnsconfd.service</Path>
<Path fileType="library">/usr/lib64/systemd/system/dbus-org.freedesktop.Avahi.service</Path>
<Path fileType="library">/usr/lib64/systemd/system/multi-user.target.wants/avahi-daemon.service</Path>
<Path fileType="library">/usr/lib64/systemd/system/sockets.target.wants/avahi-daemon.socket</Path>
<Path fileType="library">/usr/lib64/sysusers.d/avahi.conf</Path>
<Path fileType="library">/usr/lib64/tmpfiles.d/avahi.conf</Path>
<Path fileType="executable">/usr/sbin/avahi-autoipd</Path>
Expand Down Expand Up @@ -84,8 +81,6 @@
<Path fileType="data">/usr/share/defaults/avahi/hosts</Path>
<Path fileType="data">/usr/share/defaults/avahi/services/sftp-ssh.service</Path>
<Path fileType="data">/usr/share/defaults/avahi/services/ssh.service</Path>
<Path fileType="data">/usr/share/gir-1.0/Avahi-0.6.gir</Path>
<Path fileType="data">/usr/share/gir-1.0/AvahiCore-0.6.gir</Path>
<Path fileType="localedata">/usr/share/locale/ach/LC_MESSAGES/avahi.mo</Path>
<Path fileType="localedata">/usr/share/locale/ar/LC_MESSAGES/avahi.mo</Path>
<Path fileType="localedata">/usr/share/locale/bg/LC_MESSAGES/avahi.mo</Path>
Expand Down Expand Up @@ -157,7 +152,7 @@
</Description>
<PartOf>emul32</PartOf>
<RuntimeDependencies>
<Dependency release="27">avahi</Dependency>
<Dependency release="28">avahi</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/usr/lib32/girepository-1.0/Avahi-0.6.typelib</Path>
Expand Down Expand Up @@ -189,8 +184,8 @@
</Description>
<PartOf>programming.devel</PartOf>
<RuntimeDependencies>
<Dependency release="27">avahi-devel</Dependency>
<Dependency release="27">avahi-32bit</Dependency>
<Dependency release="28">avahi-devel</Dependency>
<Dependency release="28">avahi-32bit</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="data">/usr/lib32/pkgconfig/avahi-client.pc</Path>
Expand All @@ -207,7 +202,7 @@
</Description>
<PartOf>programming.devel</PartOf>
<RuntimeDependencies>
<Dependency release="27">avahi</Dependency>
<Dependency release="28">avahi</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="header">/usr/include/avahi-client/client.h</Path>
Expand Down Expand Up @@ -249,15 +244,17 @@
<Path fileType="data">/usr/lib64/pkgconfig/avahi-core.pc</Path>
<Path fileType="data">/usr/lib64/pkgconfig/avahi-glib.pc</Path>
<Path fileType="data">/usr/lib64/pkgconfig/avahi-gobject.pc</Path>
<Path fileType="data">/usr/share/gir-1.0/Avahi-0.6.gir</Path>
<Path fileType="data">/usr/share/gir-1.0/AvahiCore-0.6.gir</Path>
</Files>
</Package>
<History>
<Update release="27">
<Date>2024-07-20</Date>
<Update release="28">
<Date>2024-10-24</Date>
<Version>0.8</Version>
<Comment>Packaging update</Comment>
<Name>Reilly Brogan</Name>
<Email>[email protected]</Email>
<Name>Silke Hofstra</Name>
<Email>[email protected]</Email>
</Update>
</History>
</PISI>
4 changes: 2 additions & 2 deletions packages/k/kdeconnect/abi_symbols
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
From 1005b8157c2060ef5d97aef39085c6b6be2bdda3 Mon Sep 17 00:00:00 2001
From: Silke Hofstra <[email protected]>
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

4 changes: 4 additions & 0 deletions packages/k/kdeconnect/files/kdeconnect.dnssd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Service]
Name=%H
Type=_kdeconnect._udp
TxtText=type=desktop
12 changes: 0 additions & 12 deletions packages/k/kdeconnect/files/openssh-8.2-fix.patch

This file was deleted.

12 changes: 1 addition & 11 deletions packages/k/kdeconnect/files/series
Original file line number Diff line number Diff line change
@@ -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
14 changes: 11 additions & 3 deletions packages/k/kdeconnect/package.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name : kdeconnect

Check notice on line 1 in packages/k/kdeconnect/package.yml

View workflow job for this annotation

GitHub Actions / Checks

This package is included in the ISO. Consider validating the functionality in a newly built ISO.
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/
Expand Down Expand Up @@ -44,14 +44,22 @@
- 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

Expand Down
13 changes: 7 additions & 6 deletions packages/k/kdeconnect/pspec_x86_64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<Name>kdeconnect</Name>
<Homepage>https://kdeconnect.kde.org/</Homepage>
<Packager>
<Name>Reilly Brogan</Name>
<Email>[email protected]</Email>
<Name>Silke Hofstra</Name>
<Email>[email protected]</Email>
</Packager>
<License>GPL-2.0-or-later</License>
<PartOf>desktop.kde</PartOf>
Expand All @@ -27,6 +27,7 @@
<Path fileType="executable">/usr/bin/kdeconnect-settings</Path>
<Path fileType="executable">/usr/bin/kdeconnect-sms</Path>
<Path fileType="executable">/usr/bin/kdeconnectd</Path>
<Path fileType="library">/usr/lib/systemd/dnssd/kdeconnect.dnssd</Path>
<Path fileType="library">/usr/lib64/libkdeconnectcore.so.24</Path>
<Path fileType="library">/usr/lib64/libkdeconnectcore.so.24.08.2</Path>
<Path fileType="library">/usr/lib64/libkdeconnectpluginkcm.so.24</Path>
Expand Down Expand Up @@ -932,12 +933,12 @@
</Files>
</Package>
<History>
<Update release="79">
<Date>2024-10-19</Date>
<Update release="80">
<Date>2024-10-24</Date>
<Version>24.08.2</Version>
<Comment>Packaging update</Comment>
<Name>Reilly Brogan</Name>
<Email>[email protected]</Email>
<Name>Silke Hofstra</Name>
<Email>[email protected]</Email>
</Update>
</History>
</PISI>
4 changes: 4 additions & 0 deletions packages/s/samba/files/smb-device-info.dnssd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Service]
Name=%H
Type=_device-info._tcp
TxtText=model=RackMac
4 changes: 4 additions & 0 deletions packages/s/samba/files/smb.dnssd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Service]
Name=%H
Type=_smb._tcp
Port=445
4 changes: 3 additions & 1 deletion packages/s/samba/package.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name : samba

Check notice on line 1 in packages/s/samba/package.yml

View workflow job for this annotation

GitHub Actions / Checks

This package is included in the ISO. Consider validating the functionality in a newly built ISO.
version : 4.19.8
release : 107
release : 108
source :
- https://download.samba.org/pub/samba/stable/samba-4.19.8.tar.gz : 1aeff76c207f383477ce4badebd154691c408d2e15b01b333c85eb775468ddf6
homepage : https://samba.org
Expand Down Expand Up @@ -93,6 +93,8 @@
install -D -m00644 $pkgfiles/avahi.smb.service $installdir/usr/share/defaults/samba/avahi.smb.service
install -d -m00755 $installdir/etc/avahi/services
ln -sv /usr/share/defaults/samba/avahi.smb.service $installdir/etc/avahi/services/smb.service
# systemd resolved autodiscovery configuration
install -Dm0644 -t $installdir/usr/lib/systemd/dnssd $pkgfiles/*.dnssd
# cups
install -d -m00755 $installdir/%libdir%/cups/backend
ln -sv /usr/bin/smbspool $installdir/%libdir%/cups/backend/smb
Expand Down
Loading