Make address family search more accurate
Tor searches local interfaces for IPv4/IPv6 addresses, but it often retrieves all addresses, then filters for IPv4/IPv6.
We could make this more efficient for some of the interface address functions:
- getifaddrs doesn't take an address family, but we can check the address families of the returned addresses
- ioctl(.,SIOCGIFCONF,.) only supports AF_INET6 on AIX, or on HP-UX and Solaris with SIOCGLIFCONF, and otherwise only returns IPv4 addresses
- GetAdaptersAddresses (Win32) takes an address family as its first argument
- tor_getsockname/get_interface_address6_via_udp_socket_hack takes an address family as its first argument
A design for this could be:
- pass the address family to get_interface_addresses_raw
- pass the address family to the API-specific functions that take an address family, or when converting the address to a smartlist, include/exclude addresses matching the specified address families