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
pull/1/head
orbiter 14 years ago
parent b480b7a4d0
commit a835a22b32

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

Loading…
Cancel
Save