[Proposal] Remove dns_sd API
omri50 at gmail.com
Mon Jul 24 05:07:23 UTC 2017
Currently, Samba is able  to use both Avahi (since 2009) and dns_sd (since 2007) to advertise mDNS/DNS-SD services (smbd).
It is also able to use dns_sd to browse for SMB services on the network (smbclient).
However, after the move to Waf and the removal of autotools four years ago in cd4b413, support for enabling the dns_sd layer was lost.
In testing, reenabling support resulted in compile errors in source3/client/dnsbrowse.c.
These errors that have existed since February 2011 due to 5b26cfe and b28a2e5 (side note: the commits say they are untested).
Furthermore, advertising services (source3/smbd/dnsregister.c) has been broken since 2009, when it was changed to be event-driven (bf2347b).
In dns_register_smbd_fde_handler(), once a response from the mDNS daemon is received, the service deregisters itself—which happens almost immediately.
This means that, although it compiles, dnsregister.c does not work—it does not advertise mDNS/DNS-SD services.
The only platform (that I found) that actively uses the Samba dns_sd API support is FreeBSD, which patches Samba to enable dns_sd.
FreeBSD compiles Samba with *both* Avahi and dns_sd support.
OpenBSD only uses Avahi, while NetBSD appears to not use either.
None of Homebrew, MacPorts, or Fink contain a modern, maintained version of Samba; Samba is not much used on macOS due to Apple’s own SMB implementation.
Since the dns_sd code is broken, unmaintained, and seldom-used, I propose removing it.
mDNS/DNS-SD advertisement is well-served by Avahi on all platforms (*including* FreeBSD, as the dns_sd implementation does not work).
An Avahi-based replacement for browsing with smbclient can be made, which has the additional benefit of bringing support for this feature to Linux platforms.
The Avahi code has remained nearly unchanged since it was introduced, and continues to work fine—it is enabled with nearly all Samba distributions.
Otherwise, someone needs to take up the job of fixing and maintaining the code—which *must* include actually testing patches (5b26cfe and b28a2e5).
Keeping the status quo untenable.
: Theoretically; as explained above, dns_sd support is broken
More information about the samba-technical