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

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Jul 18 20:43:11 UTC 2017


On Mon, Jul 17, 2017 at 09:42:36PM -0700, Omri Mor via samba-technical wrote:
> Currently, users of the FULLSYNC (Time Machine) patch manually
> create an Avahi service file to advertise Time Machine volumes (see
> the GitHub PR discussions for various examples). Since Samba already
> contains built-in support for mDNS/DNS-SD (via Avahi or dns_sd,
> depending on platform), it makes sense to allow the vfs_fruit module
> to advertise `_adisk._tcp` in addition to `_smb._tcp`.
> For Avahi, I believe that this entails somehow adding a service a
> service to the service group in `avahi_client_callback()`. dns_sd
> does not seem to have the same concept of a group:
> `DNSServiceRegister()` is used directly.
> 
> In either case, it’s probably best of the actual service
> registration code remains in `avahi_register.c` and `dnsregister.c`,
> respectively. This means that some method of passing additional
> service information to the actual registration code is necessary.
> This should probably take the form of a list of service definitions
> that can be appended to. The registration code would parse the list
> and register every service therein.
> 
> 259e1706e3206b215e136ea9d5beef4c9e3fcdee added the `fruit:model`
> option. This allows also registering a `_device-info._tcp` service
> with the same model name, though I’m not sure what the effect would
> be if the two were different (i.e. which one Finder would
> prioritize).
> 
> `fruit:Time Machine` appears to currently be bugged by working only
> when set globally. Since `_adisk._tcp` defines TXT records that
> determine which shares are valid Time Machine destinations, this
> should be fixed to allow it to be set on a per-share basis, or
> otherwise reverted to `fruit:fullsync` for FULLSYNC extension
> support and using `fruit:Time Machine` for mDNS/DNS-SD service
> registration.
> 
> Pointers on how to best go about integrating the FULLSYNC patch with
> Avahi/dns_sd would be appreciated—I am new to the Samba codebase,
> but would love to contribute.

Brainstorming... Apologies if this assumes a lot of knowledge of Samba
internals.

What about creating an entry in gencache with a list of all time
machine enabled shares? This entry could be filled from
fruit_connect(), and could be read inside avahi_register().  Whenever
fruit_connect finds a time-machine enabled share, it would read that
entry and potentially extend it. It's racy, because we don't have a
locking scheme on gencache, but it's an easy place to start from that
everyone has access to.

The alternative would be a separate tdb file with a key/value pair per
time-machine share and proper per-record locks. This could be
traversed by avahi_register().  This would not solve the problem
pulling back time machine announcements, but that might be something
that fruit_connect could also do: Detect a non-time-machine share and
discard the tdb entry.

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de



More information about the samba-technical mailing list