Commit 9dd6ba75 authored by intrigeri's avatar intrigeri

New upstream version 0.20

parent 03e6be76
0.20
2019-04-16 Sam Varshavchik <mrsam@courier-mta.com>
* _ipcmp: handle comparison of mixed IPv4 and IPv6-specified
addresses, allowing cidrlookup() to look up IPv6-mapped IPv4 addresses
in IPv4 address ranges, and vice versa.
0.19
2018-06-11 Sam Varshavchik <mrsam@courier-mta.com>
......
ChangeLog
CIDR.pm
lib/Net/CIDR.pm
COPYING
Makefile.PL
MANIFEST This list of files
Net-CIDR.spec
Net-CIDR.spec.PL
README
t/test.t
......
......@@ -37,6 +37,6 @@
}
},
"release_status" : "stable",
"version" : "0.19",
"version" : "0.20",
"x_serialization_backend" : "JSON::PP version 2.97001"
}
......@@ -19,5 +19,5 @@ no_index:
- inc
requires:
Carp: '0'
version: '0.19'
version: '0.20'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
......@@ -4,9 +4,9 @@ use ExtUtils::MakeMaker;
# the contents of the Makefile that is written.
WriteMakefile(
'AUTHOR' => 'Sam Varshavchik <sam@email-scan.com>',
'ABSTRACT_FROM' => 'CIDR.pm',
'ABSTRACT_FROM' => 'lib/Net/CIDR.pm',
'NAME' => 'Net::CIDR',
'VERSION_FROM' => 'CIDR.pm', # finds $VERSION
'VERSION_FROM' => 'lib/Net/CIDR.pm', # finds $VERSION
'PREREQ_PM' => { 'Carp' => 0 }, # e.g., Module::Name => 1.1
'LICENSE' => 'perl',
'PL_FILES' => { 'Net-CIDR.spec.PL' => 'Net-CIDR.spec' }
......
Summary: Net::CIDR Perl module
Name: perl-Net-CIDR
Version: 0.20
Release: 1.%{perl_version}%{?dist}
Source0: Net-CIDR-%{version}.tar.gz
License: Perl
Group: Development/Languages
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch
%define need_perl_generators %(if rpm -q fedora-release >/dev/null 2>/dev/null; then echo "1"; exit 0; fi; echo "1"; exit 1)
%if %need_perl_generators
BuildRequires: perl-interpreter
BuildRequires: perl-generators
%else
BuildRequires: perl
%endif
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%description
The Net::CIDR perl module manipulates IPv4/IPv6 netblocks in CIDR notation
%prep
%setup -q -n Net-CIDR-%{version}
%{__perl} Makefile.PL PREFIX=$RPM_BUILD_ROOT%{_prefix}
%build
%{__make}
%install
rm -rf $RPM_BUILD_ROOT
%{__make} pure_install
find $RPM_BUILD_ROOT \( -name .packlist -o -name perllocal.pod \) -exec rm -f {} \;
%{_fixperms} %{buildroot}/*
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{perl_privlib}/Net
%{_mandir}/man3/*
%changelog
* Wed Aug 13 2003 Mr. Sam <sam@email-scan.com>
- Use preferred BuildRoot
* Sun Mar 31 2002 Mr. Sam <sam@email-scan.com>
- Changed package name to perl-Net-CIDR
* Fri Nov 2 2001 Mr. Sam <mrsam@courier-mta.com>
- Changed package name to perl-net-cidr
* Tue Jun 26 2001 Mr. Sam <mrsam@courier-mta.com>
- Initial build.
#$Revision: 1.9 $
do './CIDR.pm';
do './lib/Net/CIDR.pm';
open (X, ">Net-CIDR.spec") || die "$!\n";
......@@ -14,7 +14,7 @@ __END__
Summary: Net::CIDR Perl module
Name: perl-Net-CIDR
Version: @VERSION@
Release: 1%(%{__perl} -e 'my $v=$^V; $v =~ s/(.)/".".ord($1)/ge;print "$v\n";')
Release: 1.%{perl_version}%{?dist}
Source0: Net-CIDR-%{version}.tar.gz
License: Perl
Group: Development/Languages
......@@ -35,7 +35,7 @@ The Net::CIDR perl module manipulates IPv4/IPv6 netblocks in CIDR notation
%prep
%setup -q -n Net-CIDR-%{version}
%{__perl} Makefile.PL PREFIX=$RPM_BUILD_ROOT%{_prefix} INSTALLDIRS=vendor
%{__perl} Makefile.PL PREFIX=$RPM_BUILD_ROOT%{_prefix}
%build
%{__make}
......@@ -50,7 +50,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_prefix}/lib*/perl5/site_perl/*/Net
%{perl_privlib}/Net
%{_mandir}/man3/*
%changelog
......
# Net::CIDR
#
# Copyright 2001-2018 Sam Varshavchik.
# Copyright 2001-2019 Sam Varshavchik.
#
# with contributions from David Cantrell.
#
......@@ -50,7 +50,7 @@ use Carp;
);
$VERSION = "0.19";
$VERSION = "0.20";
1;
......@@ -798,15 +798,15 @@ sub _ipcmp {
($isipv6_1, $aa)=_ipv6to4($aa);
($isipv6_2, $bb)=_ipv6to4($bb);
if ($isipv6_1 || $isipv6_2)
{
croak "Invalid netblock: $aa-$bb"
unless $isipv6_1 && $isipv6_2;
}
my @a=split (/\./, $aa);
my @b=split (/\./, $bb);
unshift @a, (0,0,0,0,0,0,0,0,0,0,255,255)
unless $isipv6_1;
unshift @b, (0,0,0,0,0,0,0,0,0,0,255,255)
unless $isipv6_2;
croak "Different number of octets in IP addresses" unless $#a == $#b;
while ($#a >= 0 && $a[0] == $b[0])
......
......@@ -6,7 +6,7 @@
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
BEGIN { $| = 1; print "1..11\n"; }
BEGIN { $| = 1; print "1..14\n"; }
END {print "not ok 1\n" unless $loaded;}
use Net::CIDR;
$loaded = 1;
......@@ -132,3 +132,55 @@ else
{
print "not ok 11\n";
}
my @only4 = qw(
10.0.0.0/24
10.0.1.0/24
);
my @only6 = qw(
2001:db8::/64
2001:db8:1::/64
);
my @dualstack = qw(
10.0.2.0/24
2001:db8:2::/64
);
if (join("",
Net::CIDR::cidrlookup("10.0.0.1", @only4),
Net::CIDR::cidrlookup("10.0.10.1", @only4),
Net::CIDR::cidrlookup("2001:db8::1", @only4)) eq "100")
{
print "ok 12\n";
}
else
{
print "not ok 12\n";
}
if (join("",
Net::CIDR::cidrlookup("2001:db8::1", @only6),
Net::CIDR::cidrlookup("2001:db8:a::1", @only6),
Net::CIDR::cidrlookup("10.0.0.1", @only6)) eq "100")
{
print "ok 13\n";
}
else
{
print "not ok 13\n";
}
if (join("",
Net::CIDR::cidrlookup("10.0.2.1", @dualstack),
Net::CIDR::cidrlookup("10.0.20.1", @dualstack),
Net::CIDR::cidrlookup("2001:db8:2::1", @dualstack),
Net::CIDR::cidrlookup("2001:db8:20::1", @dualstack)))
{
print "ok 14\n";
}
else
{
print "not ok 14\n";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment