Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fixed isLocal() property (better recognition of intranet hosts)

orbitera835a22b329a
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);
}
}