Evaluates whether the argument is an ISATAP address. From RFC 5214: "ISATAP interface identifiers are constructed in Modified EUI-64 format [...] by concatenating the 24-bit IANA OUI (00-00-5E), the 8-bit hexadecimal value 0xFE, and a 32-bit IPv4 address in network byte order [...]" For more
(Inet6Address ip)
| 716 | |
| 717 | |
| 718 | public static boolean isIsatapAddress(Inet6Address ip) { |
| 719 | |
| 720 | // If it's a Teredo address with the right port (41217, or 0xa101) |
| 721 | // which would be encoded as 0x5efe then it can't be an ISATAP address. |
| 722 | if (isTeredoAddress(ip)) { |
| 723 | return false; |
| 724 | } |
| 725 | byte[] bytes = ip.getAddress(); |
| 726 | if ((bytes[8] | (byte) 0x03) != (byte) 0x03) { |
| 727 | |
| 728 | // Verify that high byte of the 64 bit identifier is zero, modulo |
| 729 | // the U/L and G bits, with which we are not concerned. |
| 730 | return false; |
| 731 | } |
| 732 | return (bytes[9] == (byte) 0x00) && (bytes[10] == (byte) 0x5e) |
| 733 | && (bytes[11] == (byte) 0xfe); |
| 734 | } |
| 735 | |
| 736 | /** |
| 737 | * Returns the IPv4 address embedded in an ISATAP address. |
no test coverage detected