Add IPv6 Support to is_local_addr()
We propose this optional change, to improve the accuracy of IPv6 address detection from directory documents.
Directory servers use is_local_addr() to detect if the requesting tor instance is on the same local network. If it is, the directory server does not include the X-Your-Address-Is HTTP header in directory documents.
Currently, is_local_addr() checks for:
- an internal IPv4 or IPv6 address, or
- the same IPv4 /24 as the directory server.
We propose also checking for:
- the same IPv6 /48 as the directory server.
We choose /48 because it is typically the smallest network in the global IPv6 routing tables, and it was previously the recommended per-customer network block. (See [RFC 6177: IPv6 End Site Address Assignment].)
Tor currently uses:
- IPv4 /8 and IPv6 /16 for port summaries,
- IPv4 /16 and IPv6 /32 for path selection (avoiding relays in the same network block).