classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Texual IPv6 address


From: Steven Augart
Subject: Re: Texual IPv6 address
Date: Sun, 14 Nov 2004 15:41:51 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

Mattias Rehnberg wrote:
Hello,

The java.net.Inet6Address class seems to produce invalid textual
> representations in some cases. In the example below, the output
> is IPv6:1010:::::2020::1 instead of IPv6:1010:0:0:0:0:2020:0:1
> (or 1010::2020:0:1) that one would expect. I've included a patch
>  that deactivates the suppression of zero segments.

Thank you for sending such a clear bug report and patch.  I always
like a patch that shortens the code :).

I checked against RFC2373 <http://www.faqs.org/rfcs/rfc2373.html>, and the
current behavior is clearly bogus.

To quote RFC2373:
   1. The preferred form is x:x:x:x:x:x:x:x, where the 'x's are the
      hexadecimal values of the eight 16-bit pieces of the address.
      Examples:

         FEDC:BA98:7654:3210:FEDC:BA98:7654:3210

         1080:0:0:0:8:800:200C:417A

      Note that it is not necessary to write the leading zeros in an
      individual field, but there must be at least one numeral in every
      field (except for the case described in 2.).

I've tested the patch and it works as advertised.  Committed with
the following ChangeLog entry:

2004-11-14  Mattias Rehnberg  <address@hidden>

        * java/net/Inet6Address.java (getHostAddress): Fix textual
        representation of IPv6 address with embedded zeroes
        to conform to RFC 2373.

--Steve Augart


--
Steven Augart

Jikes RVM, a free, open source, Virtual Machine:
http://oss.software.ibm.com/jikesrvm




reply via email to

[Prev in Thread] Current Thread [Next in Thread]