vfs_fruit: Time Machine/FULLSYNC: add mDNS/DNS-SD advertisement

Omri Mor omri50 at gmail.com
Sun Jul 23 09:31:20 UTC 2017

> The dns_sd interface is more difficult to work with.
> Firstly, I think there are some bugs with it as it is:
> While Avahi registers with the name from lp_netbios_name(), dns_sd pass NULL, which signifies using the default of the computer name (hostname).
> This only differs when the ‘netbios name’ option is set (and differs from the hostname). This is likely an uncommon occurrence.
> dns_register_smbd_fde_handler() appears to be bugged (badly) as well.
> When the DNSServiceProcessResult() call succeeds, talloc_free() is called on the state struct, which in turn calls the destructor, which deregisters the service.
> If the call fails, then the entire service is reinitialized.
> I suspect the intent was:
> on success, use tevent_add_fd() to wait for the next response
> on failure, deregister and free the resources
> If my understanding is correct, then dns_sd has been broken since 2009, when it was changed to be event-driven.
> I suspect that the only platform using the dns_sd interface is macOS; since Apple ships its own SMB server, there isn’t much of a Samba userbase on the platform.
> Samba isn’t even available in Homebrew, while the versions in MacPorts are ancient and unmaintained, as are those in Fink.
> In short: is there even anyone using the dns_sd interface that would suffer from its removal?

I’ve looked into it a bit further.
It looks like dns_sd support was never exposed in Waf build and was only available in autoconf.
Autoconf was removed four years ago in cd4b413; I only found FreeBSD to be patching in dns_sd support to the Waf build (more below).
When I added —enable-dnssd as an option to the Waf build (defining WITH_DNSSD_SUPPORT and linking to Avahi’s dns_sd compatibility library), the build broke: source3/client/dnsbrowse.c attempts to TALLOC_FREE a nonexistent variable ‘fdset’.
There *are* reference to an (unused) fdsetz variable, but it is defined as an int, not a pointer.
That enabling dns_sd results in compilation errors signifies to me that *no one* is using it.
Working around the problems in dnsbrowse.c (by commenting out the code), dnsregister.c does exactly what I expected it to do: deregister the service almost immediately.

In short, all support for dns_sd in Samba appears to be broken and is not being maintained.

There was a bug report about the missing dnssd switch from Waf, as well as the dnsbrowse.c compilation problems on the FreeBSD bugtracker: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=183885 <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=183885>
I found that through a somewhat-related bug (11628, https://bugzilla.samba.org/show_bug.cgi?id=11628 <https://bugzilla.samba.org/show_bug.cgi?id=11628>).
Volker responded to that one, but it appears that the submitter never followed up and thus the patch was never upstreamed.

FreeBSD is actively using dns_sd/mDNSResponder in their Samba builds, but they patch in support.
They also ship Avahi, so removing dns_sd wouldn’t impact them much.
What are your thoughts on simply removing the dns_sd code?


More information about the samba-technical mailing list