Skip to content

mdns: fix mDNS peer discovery on systems without getaddrinfo mDNS resolution#1019

Open
tinnus-napbus wants to merge 1 commit into
developfrom
tinnus-fix-mdns
Open

mdns: fix mDNS peer discovery on systems without getaddrinfo mDNS resolution#1019
tinnus-napbus wants to merge 1 commit into
developfrom
tinnus-fix-mdns

Conversation

@tinnus-napbus
Copy link
Copy Markdown
Contributor

Summary

Fix Ames mDNS peer resolution by querying IPv4 A records through DNS-SD instead of re-resolving mDNS hostnames with uv_getaddrinfo().

Problem

mDNS never worked on my linux desktop machine.

The previous mDNS flow did this:

  1. DNSServiceBrowse() discovered _ames._udp peers
  2. DNSServiceResolve() returned the peer host name and port
  3. Vere called uv_getaddrinfo() on the returned host name, forcing AF_INET

On systems where DNS-SD discovery worked but the host resolver was not able to resolve mDNS names through getaddrinfo(), startup produced:

mdns: fake-zod registered on all interfaces
mdns: getaddrinfo error: unknown node or service
mdns: getaddrinfo error: unknown node or service

This broke local peer discoverability even though DNS-SD had already resolved the service successfully.

Changes

  • Remove the uv_getaddrinfo() follow-up lookup from pkg/vere/mdns.c
  • After DNSServiceResolve(), query the peer host's IPv4 A record directly with DNSServiceQueryRecord()
  • Reorder local helper callbacks

Why This Approach

Vere already relies on DNS-SD for service discovery. Querying the A record through the same DNS-SD stack is more robust than passing an mDNS-local hostname back through the host resolver and assuming getaddrinfo() is mDNS-aware.

This preserves IPv4-only behaviour while removing a platform-dependent failure mode.

@tinnus-napbus tinnus-napbus requested a review from a team as a code owner May 24, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant