Skip to content

Conversation

@Skyline-23
Copy link

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 Skyline-23 force-pushed the master branch 5 times, most recently from f96f17a to 91a5489 Compare December 15, 2025 14:36
ifaddr may return no adapters in sandboxed environments, which prevents mDNS multicast membership and leads to empty scan results. Detect a default IPv4 via a dummy UDP connect and use it for IP_MULTICAST_IF/ADD_MEMBERSHIP while keeping the socket bind on an empty string to avoid conflicts. Reuse the same probe fallback in get_private_addresses so callers still obtain a usable IPv4 when adapter enumeration is empty.
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.

1 participant