[ipv6] RFR: 8223737: HostsFileNameService doesn't handle IPv6 literal addresses correctly

Chris Hegarty chris.hegarty at oracle.com
Mon May 13 16:32:59 UTC 2019


Arthur,

On 11/05/2019 01:17, Arthur Eubanks wrote:
> Bug: https://bugs.openjdk.java.net/browse/JDK-8223737
> Webrev: http://cr.openjdk.java.net/~aeubanks/8223737/webrev.00/index.html
> 
> HostsFileNameService doesn't handle IPv6 literal addresses correctly.
> For example, ::1 and 0:0:0:0:0:0:0:1 should yield the same output.
> 
> Rather than comparing address strings, compare the address byte arrays.

Comparison of byte arrays is much better. The changes look good.

Trivially, can I ask you to please include a number of other reverse
lookup's to fill out the test a little. Here's what I came up with:

     testReverseLookup("10.2.3.4", "testHost.testDomain");

     // ::1 and 0:0:0:0:0:0:0:1 should map to ip6-localhost
     testReverseLookup("::1", "ip6-localhost");
     testReverseLookup("0:0:0:0:0:0:0:1", "ip6-localhost");
 
testReverseLookup("0000:0000:0000:0000:0000:0000:0000:0001","ip6-localhost");

     testReverseLookup("fe00::0", "ip6-localnet");
     testReverseLookup("fe00:0:0:0:0:0:0:0", "ip6-localnet");
     testReverseLookup("fe00:0000:0000:0000:0000:0000:0000:0000", 
"ip6-localnet");

     testReverseLookup("fe80::1", "link-local-host");
     testReverseLookup("fe80:000:0:00:0:000:00:1", "link-local-host");
     testReverseLookup("fe80:0000:0000:0000:0000:0000:0000:0001", 
"link-local-host");

Thanks,
-Chris.


More information about the net-dev mailing list