[BUG] Inet6Address.isIPv4CompatibleAddress uses wrong prefix

Michael McMahon michael.x.mcmahon at oracle.com
Tue Jun 25 09:55:11 UTC 2019


On 25/06/2019, 07:37, Alan Bateman wrote:
> On 24/06/2019 21:57, Rob Spoor wrote:
>> I found a bug in Inet6Adress.isIPv4CompatibleAddress(). While parsing 
>> correctly uses the ::ffff:<IPv4> format, isIPv4CompatibleAddress() 
>> checks for ::<IPv4> instead.
> The notion "IPv4-compatible IPv6 address" is different to "IPv4-mapped 
> IPv6 address".  I think the RFCs on the IPv6 addressing architecture 
> deprecated the former a long time ago and maybe 
> isIPv4CompatibleAddress should be deprecated too. The net-dev mailing 
> list is the best place to discuss this topic (which is timely as there 
> seems to be interest there in recent time to improve the IPv6 support).
>
> -Alan.

Right. I don't see a bug. The usage is deprecated, but "::<ipv4 
address>" is in fact an IPv4 compatible IPv6 address,
whereas "::ffff:<ip v4 address>" is in effect an IPv4 address, and 
parses as an Inet4Address.

There probably is a need to bring some of these apis up to date. I think 
"site local" addresses are also deprecated
for instance.

- Michael.


More information about the net-dev mailing list