0041: Our own mDNS responder on mdns.h
- Status: Accepted (owner reported the bug, 2026-11-22)
- Date: 2026-11-22
Context
Moonlight on the same LAN (Linux desktop, Android) did not list the server. The server announced itself with mdns_cpp (ADR 0039), which answers only the _nvstream._tcp PTR question. Moonlight's resolvers (qmdnsengine on desktop, NsdManager on Android) follow the PTR with separate SRV, TXT and A questions, which mdns_cpp never answered, so the client saw the name but never got an address. mdns_cpp also answers multicast only, so one-shot queries from a random port got nothing.
Correction 2026-11-23: the Sunshine host that was listed was the client PC itself, so it said nothing about multicast. The owner's listing was still missing after this responder because the router's IGMP snooping dropped mDNS between its ports; with snooping off, Couchdogs listed itself. The PTR-only gap is still real, so the responder stays. If a client on the same LAN does not list the server but typing its address works, check IGMP snooping on the router or switch.
Decision
The server answers mDNS itself (stack/server/src/mdns_responder.cpp), using mjansson's mdns.h (Unlicense, pinned, unmodified) for the packet format. It answers PTR, SRV, TXT (couchdogs=1), A, AAAA and ANY, with the usual additional records, unicast when the question asks for it or comes from a port other than 5353. It announces with the default route's address (no Docker or link-local addresses), re-announces when that changes, and says goodbye on stop.
Not chosen: patching mdns_cpp (a fork to keep, and its design is PTR-only); Avahi on the host (a host package and D-Bus inside the container, for one service).
Consequences
Every resolver style (Android, Apple, Avahi, Windows) can find the host. The responder is ours to maintain: about 400 lines with unit tests and a loopback wire test.