-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0
-
sparc
-
solaris_2.6
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
======================================================================