A DESCRIPTION OF THE PROBLEM :
java.net.InetAddress#isSiteLocalAddress()'s JavaDoc is rather short. But the gist is that it should indicate if the given InetAddress is site local, i.e. reachable within the local site, but not routeable via the public internet.
Indeed the implementation for Inet4Addresses supports that expectation, by matching on the well known RFC1918 prefixes 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
On the other hand the problem lies with the Inet6Address implementation, which matches only on the fec0::/10 prefix. This allocation has been deprecated by RFC3879 (https://www.rfc-editor.org/rfc/rfc3879).
Instead RFC4193 (https://www.rfc-editor.org/rfc/rfc4193) introduced a new allocation of Unique Local Addresses with the fc00::/7 prefix. Conceptionally this prefix is the closest IPv6 equivalent to the RFC1918 prefixes used in IPv4. Also these ULAs are actually in use today.
Thereby I propose to update the implementation of java.net.Inet6Address#isSiteLocalAddress() to match both the deprecated fec0::/10 prefix (to not break existing code) but also the fc00::/7 prefix used for ULAs.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the minimal Java application below
---------- BEGIN SOURCE ----------
void main() {
final InetAddress ipv6ula = InetAddress.ofLiteral("fdb2:b711:e8e::1");
IO.println(ipv6ula.isSiteLocalAddress());
}
---------- END SOURCE ----------
FREQUENCY :
ALWAYS
java.net.InetAddress#isSiteLocalAddress()'s JavaDoc is rather short. But the gist is that it should indicate if the given InetAddress is site local, i.e. reachable within the local site, but not routeable via the public internet.
Indeed the implementation for Inet4Addresses supports that expectation, by matching on the well known RFC1918 prefixes 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
On the other hand the problem lies with the Inet6Address implementation, which matches only on the fec0::/10 prefix. This allocation has been deprecated by RFC3879 (https://www.rfc-editor.org/rfc/rfc3879).
Instead RFC4193 (https://www.rfc-editor.org/rfc/rfc4193) introduced a new allocation of Unique Local Addresses with the fc00::/7 prefix. Conceptionally this prefix is the closest IPv6 equivalent to the RFC1918 prefixes used in IPv4. Also these ULAs are actually in use today.
Thereby I propose to update the implementation of java.net.Inet6Address#isSiteLocalAddress() to match both the deprecated fec0::/10 prefix (to not break existing code) but also the fc00::/7 prefix used for ULAs.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the minimal Java application below
---------- BEGIN SOURCE ----------
void main() {
final InetAddress ipv6ula = InetAddress.ofLiteral("fdb2:b711:e8e::1");
IO.println(ipv6ula.isSiteLocalAddress());
}
---------- END SOURCE ----------
FREQUENCY :
ALWAYS