Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4404270

java.net.Inet6Address.isSiteLocalAddress() is inconsistent with rfc2373

    XMLWordPrintable

Details

    • sparc
    • solaris_2.6

    Description



      Name: dfR10049 Date: 01/12/2001



      isSiteLocalAddress() and isLinkLocalAddress() methods of Inet6Address class
      are inconsistent with rfc2373.

      rfc2373 states:

      2.5.8 Local-Use IPv6 Unicast Addresses
         ...

         Link-Local addresses have the following format:

         | 10 |
         | bits | 54 bits | 64 bits |
         +----------+-------------------------+----------------------------+
         |1111111010| 0 | interface ID |
         +----------+-------------------------+----------------------------+

         ...

         Site-Local addresses have the following format:

         | 10 |
         | bits | 38 bits | 16 bits | 64 bits |
         +----------+-------------+-----------+----------------------------+
         |1111111011| 0 | subnet ID | interface ID |
         +----------+-------------+-----------+----------------------------+


      But current implementations of these methods check only the prefix of address.
      They do not check that following 54 bits for Link-Local and 38 bits for Site-Local
      are zeros:

          public boolean isLinkLocalAddress() {
      return (ipaddress[0] & 0xff) == 0xfe && (ipaddress[1] & 0xc0) == 0x80;
          }

          public boolean isSiteLocalAddress() {
      return (ipaddress[0] & 0xff) == 0xfe && (ipaddress[1] & 0xc0) == 0xc0;
          }

      So the next addresses will be link local:
      [fe81::] , [fe80:100::] , [fe80:0:ff00:1::] , [fe80:0:0:1::]

      and the next addresses will be site local:
      [fec1::], [fec2::], [fec0:0:ff::fe00], [fec0::fd:0:0:0]

      This implementation is inconsistent with rfc2373

      ======================================================================

      Attachments

        Activity

          People

            ywangsunw Yingxian Wang (Inactive)
            fdasunw Fda Fda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: