From a835a22b329a224a106142f0b052ada2f043a617 Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 9 Aug 2010 11:22:56 +0000 Subject: [PATCH] fixed isLocal() property (better recognition of intranet hosts) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7028 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/net/yacy/kelondro/util/Domains.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/net/yacy/kelondro/util/Domains.java b/source/net/yacy/kelondro/util/Domains.java index 9d8b0e3ca..b279ab611 100644 --- a/source/net/yacy/kelondro/util/Domains.java +++ b/source/net/yacy/kelondro/util/Domains.java @@ -586,6 +586,10 @@ public class Domains { } public static boolean isLocal(final String host) { + return isLocal(host, true); + } + + private static boolean isLocal(final String host, boolean recursive) { if (host == null || host.length() == 0) return true; // FIXME IPv4 only @@ -601,7 +605,8 @@ public class Domains { } // check dns lookup: may be a local address even if the domain name looks global + if (!recursive) return false; InetAddress a = dnsResolve(host); - return a == null || a.isAnyLocalAddress() || a.isLinkLocalAddress() || a.isLoopbackAddress(); + return a == null || a.isAnyLocalAddress() || a.isLinkLocalAddress() || a.isLoopbackAddress() || a.isSiteLocalAddress() || isLocal(a.getHostAddress(), false); } }