summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarunknown <unknown@unknown.invalid>2015-03-01 05:54:19 +0400
committerLibravatarJanik Kleinhoff <janik@kleinhoff.de>2015-03-01 05:54:19 +0400
commitb405bba0c0ea2136d0e21bce5eef0b0fce59787f (patch)
treeb5ab514cdcc0560a3802a97cd0a4e2debd672a78
parentbd98da1d18822b0a8b7fbfc1309076051917603b (diff)
Cut down on some DNS queries
-rw-r--r--modules/inspect.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/inspect.pl b/modules/inspect.pl
index af1c06a..afaba44 100644
--- a/modules/inspect.pl
+++ b/modules/inspect.pl
@@ -6,6 +6,7 @@ use feature qw(say);
use Data::Dumper;
#use List::Util qw(first);
use String::Interpolate qw(interpolate);
+use Carp qw(cluck);
%::ignored = ();
sub new
@@ -31,7 +32,9 @@ sub inspect {
$rev = sprintf("%d.%d.%d.%d.", hex($4), hex($3), hex($2), hex($1));
}
}
- else {
+ if ( (!defined($rev)) && ($event->{type} eq 'join') ) {
+# Only doing DNS lookups for join events will mean that DNSBL will break if we try to do it on something other than joins,
+# But it also means we cut back on the DNS lookups by a metric shitton
$iaddr = gethostbyname($event->{host}) if ($event->{host} !~ /\//);
$rev = join('.', reverse(unpack('C4', $iaddr))).'.' if (defined $iaddr);
}