diff --git a/core/java/src/net/i2p/util/Addresses.java b/core/java/src/net/i2p/util/Addresses.java index 725631f7c..147db9d66 100644 --- a/core/java/src/net/i2p/util/Addresses.java +++ b/core/java/src/net/i2p/util/Addresses.java @@ -52,6 +52,7 @@ public abstract class Addresses { private static final Map _ifCache = INET6_CACHE_ENABLED ? new HashMap(8) : null; /** 12 char hex lower case */ private static final Set _macCache = new HashSet(); + private static final boolean TEST_IPV6_ONLY = false; /** * Do we have any non-loop, non-wildcard IPv4 address at all? @@ -251,6 +252,18 @@ public abstract class Addresses { private static boolean shouldInclude(InetAddress ia, boolean includeSiteLocal, boolean includeLoopbackAndWildcard, boolean includeIPv6) { + if (TEST_IPV6_ONLY) { + byte[] ip = ia.getAddress(); + if (ip.length == 4) { + int i = ip[0] & 0xff; + if (i != 127 && + i != 192 && + i != 10 && + i != 0) + return false; + } + } + return (!ia.isLinkLocalAddress()) && // 169.254.x.x (!ia.isMulticastAddress()) &&