I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 887017b5 authored by zzz's avatar zzz
Browse files

* Transport: Treat more IPs as local

   25/8 - Hamachi (moved from 5/8 Nov. 2012)
   2620:9b::/32 - Hamachi
   0::/8 - Includes IPv4 compatibility addresses ::xxxx:xxxx
parent 3a4f5a2f
No related branches found
No related tags found
No related merge requests found
...@@ -120,9 +120,17 @@ public abstract class TransportUtil { ...@@ -120,9 +120,17 @@ public abstract class TransportUtil {
if (a0 == 169 && a1 == 254) return false; if (a0 == 169 && a1 == 254) return false;
// 5/8 allocated to RIPE (30 November 2010) // 5/8 allocated to RIPE (30 November 2010)
//if ((addr[0]&0xFF) == 5) return false; // Hamachi //if ((addr[0]&0xFF) == 5) return false; // Hamachi
// Hamachi moved to 25/8 Nov. 2012
// Assigned to UK Ministry of Defence
// http://blog.logmein.com/products/changes-to-hamachi-on-november-19th
if (a0 == 25) return false;
return true; // or at least possible to be true return true; // or at least possible to be true
} else if (addr.length == 16) { } else if (addr.length == 16) {
if (allowIPv6) { if (allowIPv6) {
// loopback, broadcast,
// IPv4 compat ::xxxx:xxxx
if (addr[0] == 0)
return false;
// disallow 2002::/16 (6to4 RFC 3056) // disallow 2002::/16 (6to4 RFC 3056)
if (addr[0] == 0x20 && addr[1] == 0x02) if (addr[0] == 0x20 && addr[1] == 0x02)
return false; return false;
...@@ -133,6 +141,9 @@ public abstract class TransportUtil { ...@@ -133,6 +141,9 @@ public abstract class TransportUtil {
// disallow 2001:0::/32 (Teredo RFC 4380) // disallow 2001:0::/32 (Teredo RFC 4380)
if (addr[0] == 0x20 && addr[1] == 0x01 && addr[2] == 0x00 && addr[3] == 0x00) if (addr[0] == 0x20 && addr[1] == 0x01 && addr[2] == 0x00 && addr[3] == 0x00)
return false; return false;
// Hamachi IPv6
if (addr[0] == 0x26 && addr[1] == 0x20 && addr[2] == 0x00 && (addr[3] & 0xff) == 0x9b)
return false;
try { try {
InetAddress ia = InetAddress.getByAddress(addr); InetAddress ia = InetAddress.getByAddress(addr);
return return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment