calrissian / mango

Common utilities for rapid application development
Apache License 2.0
17 stars 7 forks source link

Proper handling of IPv6 "IPv4 mapped" addresses #134

Closed eawagner closed 9 years ago

eawagner commented 9 years ago

These addresses follow the pattern "::ffff:192.168.0.1" where the 11th and 12th bytes are set all 0xFF and the 13th through 16th bytes represent the IPv4 address.

Currently in Java, the InetAddress.getAddress() function will automatically convert these to Inet4Addresses. This can cause issues with things such as the encoders which should be able to handle a valid the correct encodings for any IPv6.

There is a workaround for generating Inet6Addresses in Java however using the Inet6Address.getAddress() functions which allow for a way to make this functionality work. The downside to this is that handling of IPv6(Inet6Address) addresses needs to be consistently across the codebase.

eawagner commented 9 years ago

Discussion of this topic in guava is covered in their Issue 986.