mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #1474] Libresport discovery not reachable on FreeBSD and maybe other BSDs #663
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#663
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rosorio on GitHub (Mar 14, 2025).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1474
Hi,
At the beginning of this week I found an issue with latest release of spotifyd (0.4.0) not reachable on FreeBSD when the previous (0.3.5) works like a charm.
It turns out that the latest version of librespot uses dualstack to bind the discovery service on non windows OSs,
bu the way it's done doesn't work on FreeBSD.
I did some tests on C and dualstack works properly on FreeBSD.
I still investigation how the rust call doesn't work here.
@kingosticks commented on GitHub (Mar 14, 2025):
Can you fix this report? It's missing all the required information. We could assume you tried the
zeroconf-interfaceoption on the latest release but it would be more helpful if you could provide that context here, along with the other details we ask for. Please assume we don't know anything about downstream projects.@kingosticks commented on GitHub (Mar 14, 2025):
Having read your linked issue and made some assumptions:
I've no experience using FreeBSD, but isn't this explained at https://man.freebsd.org/cgi/man.cgi?query=inet6 ?
and
It seems the system-wide default for FreeBSD is the same as Windows. FreeBSD have decided they don't like the way wildcard binds were mandated to work by the standards committee. They decided to do it differently. They suggest using two sockets instead of a single dual-stack socket, or perform explicit per-socket configuration. But as you pointed out (and here), Rust's std::net doesn't have a way to (un)set the
IPV6_V6ONLYsocket option like you did in C. You have to use lower level unsafe code to do that. I think we'd rather avoid that.I suggest the workaround is to add freebsd to the existing special case for Windows. And/or have
DiscoveryServeruse thezeroconf_ipoption (currently only used by some mdns backends) so people can control this themselves. It is weird that we allow controlling the port but not the interface here.@rosorio commented on GitHub (Mar 14, 2025):
In fact it is possible to have the same behavior in rust by explicitly enabling the IPV6_V6ONLY flag using socket2. The following code works on FreeBSD creating a dualstack socket.
I will see if it's feasible to patch librespot this way.
On the other side assuming ipv4 only is the easy way :)
Thanks for your help
@kingosticks commented on GitHub (Mar 14, 2025):
Yes, nobody said it wasn't possible.
socket2is a higher-level library around unsafe code to set the socket option. Annoying to have to pull in another dependency to sort this, but maybe that is preferable to messing around with what each BSD variant decided was best.Indeed, we don't need dual-stack, we don't really care. We only want it to Just Work for the user. But just assuming IPv4 seems a bit sad/lazy in 2025.
@rosorio commented on GitHub (Mar 14, 2025):
agree, since it's not librespot responsibility , we can close this issue.