Netatalk / netatalk

Netatalk is a Free and Open Source AFP fileserver. A *NIX or BSD system running Netatalk is capable of serving many Macintosh clients simultaneously as an AppleShare file server.
https://netatalk.io
GNU General Public License v2.0
332 stars 85 forks source link

Support for SLP #1370

Open rdmark opened 1 month ago

rdmark commented 1 month ago

This is about forward-porting SLP (a.k.a. srvloc a.k.a. Server Location Protocol) from 2.x to the main branch.

It should be integrated in a better way, ideally to allow Zeroconf and SLP to co-exist side by side. But if unfeasible, the build system should only allow building with one or the other enabled.

In 2.x, the current state is that you can configure and build with both service discovery protocols, but only one will actually function.

SLP was used for service discovery in OSX 10.0 and 10.1, and reportedly also supported in OS9.

NJRoadfan commented 3 weeks ago

MacOS 9 supports SLP 2.0, which works with Netatalk 2.x out of the box. MacOS 8.5 and 8.6 shipped with SLP 1.0, which is not compatible with the later protocol. Copying the extension from an OS9 install works though. In 3.x, any addition of SLP would be to the netatalk daemon, as all the Zeroconf setup was moved there.

I don't know why SLP would conflict with Zeroconf/mDNS as they use separate ports.

rdmark commented 2 weeks ago

I don't know why SLP would conflict with Zeroconf/mDNS as they use separate ports.

I'm certain this is simply a bug in netatalk.

rdmark commented 2 weeks ago

One situation we have to deal with here is the fact that OpenSLP is an abandoned project (2.0.0 released in 2013). As a result, it's started getting dropped from various repositories. Notably Debian and Alpine (both in 2016). And on macOS, the homebrew package is Intel-only with no support for Apple Silicon. Just to mention a few.

Fedora still distributes a package, however.

One idea to entertain here would be to bundle OpenSLP with netatalk, like we do with WolfSSL. The license is BSD-3-clause, which is compatible with GPLv2 to my best understanding.

This is the amount of code we would be dealing with:

~/dev/openslp/openslp$ cloc .
     284 text files.
     242 unique files.                                          
      46 files ignored.

github.com/AlDanial/cloc v 1.96  T=0.26 s (944.5 files/s, 345241.2 lines/s)
------------------------------------------------------------------------------------
Language                          files          blank        comment           code
------------------------------------------------------------------------------------
C                                    68           4631          12684          23702
Text                                 15           8128              0          14671
HTML                                 43           1338            756           6464
MSBuild script                       18              0              0           5004
C/C++ Header                         50            854           3022           2208
XML                                  14              0              0           1907
yacc                                  2             70            103            593
m4                                    2             29             10            306
Bourne Shell                         13             61             58            283
make                                 10             75            284            283
lex                                   2             70            107            257
Visual Studio Solution                3              3              3            256
Bourne Again Shell                    2             29             44            164
------------------------------------------------------------------------------------
SUM:                                242          15288          17071          56098
------------------------------------------------------------------------------------

Additionally, we would have to write Meson build scripts for it. Currently Autotools.

NJRoadfan commented 2 weeks ago

Maybe contact the author @jcalcote about doing another release? There are commits from the past few years that haven't seen release.

From the netatalk perspective, are there any users actually using clients that only support SLP? MacOS X 10.0 and 10.1 were rare out on the field, even back in the early 2000s. When 10.2 came out, pretty much everybody upgraded and didn't look back! As for MacOS 9, most folks are/were likely relying on AppleTalk for service location.

I think the main reason why SLP was removed is that the original implementation was janky and hacked into afp_config.c. It likely also needed additional work to support the new multi-interface listener option. Instead of refactoring as a module of the netatalk daemon, it was dropped due to lack of use.