You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Explicit interface list scans adapters even when it has no IPv6 entries #1917
When interfaces is an explicit list, normalize_interface_choice always calls ip6_addresses_to_indexes, which calls ifaddr.get_adapters() before looking at the list. The scan runs even when the list holds only IPv4 addresses, where its result is never used.
ifaddr.get_adapters() is blocking, and both the constructor and async_update_interfaces run on the event loop, so this is a blocking call on the loop that could be avoided. It is sub-millisecond on Linux but can be slower with GetAdaptersAddresses on Windows.
An IPv4-only list is the normal case for:
macOS and FreeBSD callers, which cannot use dual-stack and pass IPv4 addresses with IPVersion.V4Only.
Any caller that has fallen back to IPVersion.V4Only.
Return early from ip6_addresses_to_indexes when the list has no int entries and no IPv6 strings, so no adapter scan happens.
Related
The list branch silently drops entries that are already resolved ((address, flowinfo, scope_id), index) tuples: ip6_addresses_to_indexes only handles int and str, although its signature accepts the tuple form. A caller that has already scanned the adapters off the loop therefore cannot hand in resolved interfaces to avoid the second scan. Accepting those tuples as-is would let callers skip the on-loop scan for IPv6 too.
Activity