Skip to content

discovery: fall back to IPv4 when IPv6 is unavailable - #1762

Open
iibaranov-IG wants to merge 1 commit into
librespot-org:devfrom
iibaranov-IG:fix/discovery-ipv4-fallback
Open

iibaranov-IG wants to merge 1 commit into
librespot-org:devfrom
iibaranov-IG:fix/discovery-ipv4-fallback

Conversation

@iibaranov-IG

Copy link
Copy Markdown
Contributor

On IPv4-only Linux systems, the discovery HTTP server currently binds the IPv6 wildcard address and aborts startup when the kernel returns Address family not supported. The libmdns responder already tolerates the same condition, but discovery never reaches it because the TCP listener fails first.

This change keeps the preferred dual-stack IPv6 listener on supported non-Windows systems and retries with the IPv4 wildcard address when that bind fails. Windows continues to use IPv4 directly.

Validation:

  • cargo fmt --all -- --check
  • cargo test -p librespot-discovery discovery_listener (4 passed)
  • The same test suite passed in a Linux container with net.ipv6.conf.all.disable_ipv6=1
  • cargo build -p librespot-discovery
  • cargo clippy -p librespot-discovery --all-targets -- -D warnings

Closes #1736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discovery failing on IPv4 only setups

1 participant