From: Dirk Koopman Date: Wed, 4 Jan 2023 23:35:57 +0000 (+0000) Subject: fix DXCIDR inet_pton calls X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=61fe8f951eba89d430046d23bca9d65b30561578;p=spider.git fix DXCIDR inet_pton calls --- diff --git a/cmd/show/badip.pl b/cmd/show/badip.pl index 475abde1..b378abde 100644 --- a/cmd/show/badip.pl +++ b/cmd/show/badip.pl @@ -14,7 +14,7 @@ my @added; my @in = split /\s+/, $line; my $maxlth = 0; -$DB::single = 1; +#$DB::single = 1; my @list = map {my $s = $_; $s =~ s|/32$||; $maxlth = length $s if length $s > $maxlth; $s =~ /^1$/?undef:$s} DXCIDR::list(); diff --git a/perl/DXCIDR.pm b/perl/DXCIDR.pm index 506b9693..230920f9 100644 --- a/perl/DXCIDR.pm +++ b/perl/DXCIDR.pm @@ -16,7 +16,7 @@ use DXUtil; use DXLog; use IO::File; use File::Copy; -use Socket qw(inet_pton inet_ntop); +use Socket qw(AF_INET AF_INET6 inet_pton inet_ntop); our $active = 0; our $badipfn = "badip"; @@ -128,7 +128,7 @@ sub _sort my @in; my @out; for (@_) { - push @in, [inet_pton($_), split m|/|]; + push @in, [inet_pton(m|:|?AF_INET6:AF_INET, $_), split m|/|]; } @out = sort {$a->[0] <=> $b->[0]} @in; return map { "$_->[1]/$_->[2]"} @out;