[codex] Respect zeroconf-ip on avahi backend#1708
Open
patrik-sandin wants to merge 4 commits intolibrespot-org:devfrom
Open
[codex] Respect zeroconf-ip on avahi backend#1708patrik-sandin wants to merge 4 commits intolibrespot-org:devfrom
patrik-sandin wants to merge 4 commits intolibrespot-org:devfrom
Conversation
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.
Summary
This fixes the Avahi zeroconf backend so
--zeroconf-ipactually limits which interface(s) get advertised.Root Cause
launch_avahiacceptedzeroconf_ipbut discarded it before spawningavahi_task. As a result, the Avahi path always calledEntryGroup::add_servicewithAVAHI_IF_UNSPECand advertised on every interface, regardless of the requested IP list.What Changed
ifaddrshelper that maps configured IP addresses to OS interface indices viagetifaddrs(3)andif_nametoindex(3)zeroconf_ipthroughlaunch_avahiintoavahi_taskAVAHI_IF_UNSPECwith a warning when resolution fails or yields no matcheslibcdependency required for the Avahi helperImpact
On Avahi-backed setups, especially Raspberry Pi OS where Avahi is the default backend,
--zeroconf-ipnow constrains Spotify Connect advertisements to the requested interface(s) instead of leaking onto every local address.Validation
cargo build --features with-avahi -p librespot-discoverycargo test --features with-avahi -p librespot-discoverycargo clippy --features with-avahi -p librespot-discovery -- -D warningsNotes
I wasn't able to run a live
avahi-browse -r _spotify-connect._tcpcheck in this environment because the workspace is macOS-based and doesn't have a running Avahi daemon.