Allow AF_NETLINK in the systemd unit so the MAC-derived client id is detected - #53
Merged
chrisuthe merged 1 commit intoSep 14, 2026
Conversation
…detected glibc's getifaddrs() reads the interface list over netlink and has no fallback, so under RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 MAC detection fails and a player with no id says client/hello with an empty client_id, which Music Assistant refuses with "No key provided". The hardening step in CI now opens a WebSocket to the unit and requires the hello it is sent to carry a non-empty client_id, and fails if the invocation's journal logs "getifaddrs failed". ROADMAP and the wiki drop the claim that netlink was unneeded, and Troubleshooting gives existing installs a drop-in workaround.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under the shipped systemd unit a player with no
idis never taken by Music Assistant. Reported on 0.1.6 on a Raspberry Pi 4 (installed withscripts/get_started_linux.sh, MA 2.10.2). Runningsendspin-cliby hand works.W sendspin.network_info: getifaddrs failed; cannot auto-detect MAC addressException in task ... SendspinProvider._handle_client_added ...: No key providedCause
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6blocks netlink. glibc'sgetifaddrs()reads the interface list over netlink and has no fallback. sendspin-cpp v0.7.2 derives the defaultclient_idfrom the interface MAC while buildingclient/hello, so when detection fails the hello goes out with an emptyclient_id, and MA's cache asserts on the empty key.The unit comment, ROADMAP and a CI comment all said netlink was unneeded because glibc falls back. That was checked for mDNS browse and resolve, the A-record lookup and dialing, but never for MAC detection.
Changes
AF_NETLINKadded toRestrictAddressFamilies=, with the comment rewritten to say why it is needed and what the family admits. rtnetlink refuses changes withoutCAP_NET_ADMIN, which the empty bounding set rules out. The family also admits other netlink protocols, and no directive narrows it toNETLINK_ROUTE.systemd: trueleg, not only avahi):python3WebSocket handshake to the unit's port. It requires the first message to beclient/hellowith a non-emptyclient_id. An inbound connection is sent its hello right after the upgrade, which is where detection runs, so nothing else in the step reaches it.getifaddrs failed. It requires the invocation's startup line first, so an empty or unreadable journal fails instead of passing.[Service]/RestrictAddressFamilies=AF_NETLINK), plus theid =alternative and its identity caveat.No C++ changes.
How the check was shown to fail under the old directive
This was a local run, not CI. I built the CLI at this branch against sendspin-cpp v0.7.2 in an
ubuntu:24.04container and ran it with no--id. I then ran the exact python check frombuild.ymlagainst it:socket(AF_NETLINK)refused withEAFNOSUPPORTby a seccomp profile (the same denialRestrictAddressFamilies=applies), the check exits 1 withclient/hello carried an empty client_id, and the player logsW sendspin.network_info: getifaddrs failed; cannot auto-detect MAC address.client_idis a MAC, and there is nogetifaddrsline.Seccomp stands in for systemd there. CI on this PR is the first run under the real unit.
systemd-analyze verifypasses on the new unit (systemd 255).Not in this PR
client_idbelongs in sendspin-cpp. The fix goes there, and the library bump gets its own PR.