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

Switch mdns resolver #3767

wants to merge 4 commits into from

Conversation

silkeh
Copy link
Member

@silkeh silkeh commented Sep 8, 2024

Summary

This PR switches to using systemd-resolved as the default resolver, replacing avahi-daemon.

Resolves #2443

Test Plan

Basic resolution:

  1. Install packages from this PR
  2. Reboot or stop/start the correct services:
    sudo systemctl stop avahi-daemon.{socket,service}
    sudo systemctl restart systemd-resolved
    killall kdeconnectd
    
  3. Resolve local hosts in the network:
    resolvectl query --cache=no -p mdns <host>.local
    
  4. Resolve device info from a different machine:
    $ resolvectl query --cache=no -p mdns --type=TXT <host>._device-info._tcp.local
    <host>._device-info._tcp.local IN TXT "model=RackMac"
    

KDE connect:

  1. Ensure KDE connect is started:
    kdeconnect-cli -l
    
  2. Discover from a different device:
    kdeconnect-cli -l
    
  3. Do manual resolution on a different device:
    $ resolvectl query --cache=no -p mdns --type=TXT <host>._kdeconnect._udp.local
    <host>._kdeconnect._udp.local IN TXT "type=desktop"
    

Resolution timeouts using time getent hosts -s $service $host against IPv4-only and IPv6-only hosts:

Service Host Time
mdns_minimal IPv4 1.140 s
mdns_minimal IPv6 0.104 s
resolve IPv4 1.510 s
resolve IPv6 0.002 s

Note that the increased delay seems mostly because systemd also uses jitter (up to 250 ms per request). This results in mDNS timeouts theoretically taking between 875 ms and 1625 ms. Realistically it's more around 1.5 s.

Checklist

  • Package was built and tested against unstable

@silkeh
Copy link
Member Author

silkeh commented Sep 8, 2024

I had a couple of issues that cropped up when switching:

  • systemd-resolved has a 'Hostname conflict' caused by:
    • Receiving its own record on a different VLAN via the mDNS reflector running on my router. Fixed by configuring one interface with connection.mdns=yes and the rest with connection.mdns=resolve via nmcli. (edit: this might have been caused by KDE connect, I can't reproduce it anymore).
    • KDE connect. This service was already conflicting with Avahi (see this upstream issue). I've added a commit to disable the built-in mDNS announcer in KDE connect until it can play nice.
  • Kerberos slowed down because of TXT _kerberos.local queries slowing down. Resolved by setting dns_lookup_realm=false (which should probably have been the case already).

@silkeh silkeh force-pushed the switch-mdns-resolver branch from 140af50 to 3381f6f Compare September 8, 2024 17:35
Copy link
Contributor

@ermo ermo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The avahi, baselayout and samba changes look sane to me.

@ermo ermo added Topic: Platform Integration Integration of various components within Solus Topic: Plumbing Core components labels Oct 20, 2024
@ermo ermo added this to the Solus 4.7 milestone Oct 20, 2024
**Summary**

Add mDNS discovery definitions for use with systemd resolved as mDNS resolver.
**Summary**
Disable by default in favour of systemd-resolved.
**Summary**

- Enable mDNS resolving in systemd-resolved to replace avahi-daemon.
- Reduce the mDNS timeout to within reasonable bounds.
@silkeh silkeh force-pushed the switch-mdns-resolver branch from 3381f6f to 816a529 Compare October 24, 2024 14:09
**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.
@silkeh silkeh force-pushed the switch-mdns-resolver branch from 816a529 to af369ea Compare October 24, 2024 15:07
@silkeh
Copy link
Member Author

silkeh commented Oct 24, 2024

I've dropped the baselayout change as that can't be updated, and it actually works with the current configuration.

@silkeh silkeh marked this pull request as ready for review October 24, 2024 15:11
@silkeh silkeh marked this pull request as draft October 24, 2024 15:20
@silkeh
Copy link
Member Author

silkeh commented Oct 24, 2024

This is currently blocked on compatibility:

@silkeh silkeh added Blocked: Upstream This is an upstream issue. Blocked: Other This is blocked on something else labels Oct 24, 2024
@malfisya malfisya removed the Blocked: Other This is blocked on something else label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked: Upstream This is an upstream issue. Topic: Platform Integration Integration of various components within Solus Topic: Plumbing Core components
Projects
Status: Needs More Info
Development

Successfully merging this pull request may close these issues.

Use systemd-resolved w/MulticastDNS=true instead of avahi-daemon
4 participants