pyatv icon indicating copy to clipboard operation
pyatv copied to clipboard

fix(net): fallback multicast join without adapters

Open Skyline-23 opened this issue 1 month ago • 0 comments

This pull request improves network interface detection and multicast socket setup for sandboxed platforms where ifaddr may return no adapters. When adapters are present, behavior is unchanged. The fallback uses a dummy UDP connect (no traffic sent) solely to learn the default local IPv4.

Network interface detection improvements

  • get_private_addresses now probes the default IPv4 via a dummy UDP connect when no adapters are reported, keeping loopback filtering rules.

Multicast socket setup enhancements

  • mcast_socket falls back to the probed default IPv4 for IP_MULTICAST_IF/IP_ADD_MEMBERSHIP, with a final 0.0.0.0 membership attempt if probing fails.
  • Binding remains "", avoiding port conflicts while only multicast membership targets the detected address.

Skyline-23 avatar Dec 05 '25 09:12 Skyline-23