X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=perl%2FDXCIDR.pm;h=821152209a73c6e7cd7353f3bf2b25e8de905d1c;hb=2ef7a1dea1a74d743a7d806a58f97f55f90effcd;hp=5a6272aa4747e0c813b96431b5932b5df22f1516;hpb=cbbf83baa54e859c382de79954607923cbb1b653;p=spider.git diff --git a/perl/DXCIDR.pm b/perl/DXCIDR.pm index 5a6272aa..82115220 100644 --- a/perl/DXCIDR.pm +++ b/perl/DXCIDR.pm @@ -44,6 +44,7 @@ sub _read chomp; next if /^\s*\#/; next unless /[\.:]/; + next unless $_; push @out, $_; } $fh->close; @@ -82,6 +83,8 @@ sub _put sub append { + return 0 unless $active; + my $suffix = shift; my @in = @_; my @out; @@ -104,6 +107,7 @@ sub append sub add { + return 0 unless $active; my $count = 0; for my $ip (@_) { @@ -127,6 +131,8 @@ sub add sub clean_prep { + return unless $active; + if ($ipv4 && $count4) { $ipv4->clean; $ipv4->prep_find; @@ -150,6 +156,7 @@ sub _sort sub list { + return () unless $active; my @out; push @out, $ipv4->list if $count4; push @out, $ipv6->list if $count6; @@ -199,6 +206,8 @@ sub _touch sub reload { + return 0 unless $active; + new(); my $count = 0; @@ -224,6 +233,8 @@ sub reload sub new { + return 0 unless $active; + $ipv4 = Net::CIDR::Lite->new; $ipv6 = Net::CIDR::Lite->new; $count4 = $count6 = 0;