Repository navigation
Description
In mdns-sd 0.21.4 on Linux, ServiceDaemon::new starts socket construction asynchronously.
Zeroconf::new can fail both wildcard UDP5353 binds with EADDRINUSE, retain neither
publication socket, and still initialize DaemonStatus::Running. register() Ok and a
later status() reply therefore do not establish local publication prerequisites.
Initial bind failures are debug messages before a monitor can be installed; monitor
queues can also drop events. We do not require remote packet delivery confirmation.
A bounded reproduction uses a disposable network namespace, one up private IPv4
interface and exclusive UDP5353 occupants (no SO_REUSEADDR/SO_REUSEPORT). Leave the
interface intact, construct ServiceDaemon, register a service, then query status.
Actual binds fail while status remains Running. Separating families with the namespace's
bindv6only setting demonstrates IPv4-only and IPv6-only failures independently.
Related source findings:
- IPv4 set_multicast_ttl_v4(255) errors are discarded before retaining the socket.
- Constructor join failures are logged as skipped but still insert the address.
- An occupied add_interface entry inserts a new address and emits IpAdd after a failed join.
- The vacant branch already returns without insertion on join failure.
A consumer needs a bounded daemon-thread operation, ordered after registration, which
checks actual socket/clone/poller prerequisites, successful membership bookkeeping,
the registered service and its interface restrictions, and current selected interface
identity. A capacity-one nonblocking reply avoids dependence on monitor delivery.
Its result should explicitly mean point-in-time LOCAL prerequisites, not completed
probing, remote receipt or continuing multicast health.
For a single-address IPv4 consumer, we have tested a small carry patch that rejects
TTL/join failures, verifies the exact registered service/name/index/address, rejects
ambiguous address ownership across all OS interfaces (including down/loopback), and
sets the source on the actual daemon socket. It requires IPv4; IPv6 failure may be
optional for that consumer. This is application policy, not a proposal to impose IPv4
requirements on all mdns-sd users.
Important upstream distinction: Linux multicast membership is per interface. A second
address on an already joined interface may return EADDRINUSE despite valid membership.
Our single-address consumer deliberately fails closed on this condition. A general
upstream solution should track successful membership per ifindex/family and distinguish
already-held membership from a genuine failure; blindly copying that conservative
occupied-branch return would regress multi-address use cases.
No continuous polling, preflight port-free probe, custom DNS or packet-delivery heuristic
is necessary. Are you open to a truthful daemon-owned prerequisite API and the setup/
bookkeeping fixes, with proper upstream per-interface membership semantics?
Activity
keepsimple1 commentedon Oct 1, 2026
Thank you for opening this issue. There are multiple sub-issues here, I will address them in a number of PRs. The first one is in #515 .
keepsimple1 commentedon Oct 17, 2026
The 2nd and 3rd, 4th items are fixed by #523.
keepsimple1 commentedon Oct 17, 2026
@SoulessRaven for the rest of this issue, I've opened a PR #524 with the following solution:
ServiceDaemon::new()will returnErrif both IPv4 and IPv6 failed to bind.status()API (not a new API)DaemonStatus::Runningwill include aRunningStatethat contains detailed states, namelyIpv4StateandIpv6State.Will this approach work for you?
RunningStatecan be enhanced to include more info if you need.feat: report detailed state in DaemonStatus::Running (#524)
keepsimple1 commentedon Nov 14, 2026
I've merged PR #524 into
main. I believe this solved the last open item of this issue. Please give it a try. If any problems, please open a new issue (or follow up there). Thanks!