#318 ACLs with RegExp are very slow - aggressive resolver timeouts

This commit is contained in:
Oliver Gorwits
2017-06-24 14:42:50 +01:00
parent 1cdb6f7a63
commit a61d5aecf8
2 changed files with 3 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
[BUG FIXES]
* #320 DNS subroutines are redefined
* #318 ACLs with RegExp are very slow - aggressive resolver timeouts
2.036001 - 2017-06-22

View File

@@ -103,12 +103,13 @@ sub check_acl {
my $addr = NetAddr::IP::Lite->new($real_ip) or return 0;
my $all = (scalar grep {m/^op:and$/} @$config);
my $name = undef; # only look up once, and only if qr// is used
my $ropt = { retry => 1, retrans => 1, udp_timeout => 1, tcp_timeout => 2 };
INLIST: foreach my $item (@$config) {
next INLIST if $item eq 'op:and';
if (ref qr// eq ref $item) {
$name = ($name || hostname_from_ip($addr->addr) || '!!none!!');
$name = ($name || hostname_from_ip($addr->addr, $ropt) || '!!none!!');
if ($name =~ $item) {
return 1 if not $all;
}