[ipv6] RFR: 8223737: HostsFileNameService doesn't handle IPv6 literal addresses correctly
Arthur Eubanks
aeubanks at google.com
Mon May 13 17:59:22 UTC 2019
*From: *Chris Hegarty <chris.hegarty at oracle.com>
*Date: *Mon, May 13, 2019 at 9:33 AM
*To: *Arthur Eubanks, OpenJDK Network Dev list
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.
>
Added the extra reverse lookups.
I also noticed that the test is catching UnknownHostException and not
rethrowing it, so I removed the try/catch.
Updated webrev:
http://cr.openjdk.java.net/~aeubanks/8223737/webrev.01/index.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190513/4bf9250e/attachment-0001.html>
More information about the net-dev
mailing list