diff src/dnsbl.cpp @ 128:9ab51896447f stable-5-18

don't do uribl lookups on rfc1918 address space
author carl
date Thu, 27 Apr 2006 10:05:43 -0700
parents 2b1a4701e856
children c5cd1261394d
line wrap: on
line diff
--- a/src/dnsbl.cpp	Sat Apr 08 10:06:09 2006 -0700
+++ b/src/dnsbl.cpp	Thu Apr 27 10:05:43 2006 -0700
@@ -709,6 +709,10 @@
 	in_addr ip;
 	if (inet_aton(hostname, &ip)) {
 		const u_char *src = (const u_char *)&ip.s_addr;
+		if (src[0] == 127) return false;	// don't do dns lookups on localhost
+		if (src[0] == 10)  return false;	// don't do dns lookups on rfc1918 space
+		if ((src[0] == 192) && (src[1] == 168)) return false;
+		if ((src[0] == 172) && (16 <= src[1]) && (src[1] <= 31)) return false;
 		static char adr[sizeof "255.255.255.255"];
 		snprintf(adr, sizeof(adr), "%u.%u.%u.%u", src[3], src[2], src[1], src[0]);
 		return (uriblookup(priv, adr, NULL, found));