The check for isUniqueLocalAddress given in listing 10.15 is incorrect according to the definition of IPv6 unique local addresses. The code checks if the address starts with the bytes 0xFD, 0x00 but the correct prefix is in fact FD00/7 - i.e., only the first 7 bits are considered. (In fact the prefix is given as FC00::/7in the RFC - the two are equivalent as they differ only in the 8th bit).
The correct definition of isUniqueLocalAddress should be the following:
The check for
isUniqueLocalAddress
given in listing 10.15 is incorrect according to the definition of IPv6 unique local addresses. The code checks if the address starts with the bytes0xFD, 0x00
but the correct prefix is in factFD00/7
- i.e., only the first 7 bits are considered. (In fact the prefix is given asFC00::/7
in the RFC - the two are equivalent as they differ only in the 8th bit).The correct definition of
isUniqueLocalAddress
should be the following: