Hello community, here is the log from the commit of package perl-Net-Netmask for openSUSE:Factory checked in at 2015-05-06 07:49:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Net-Netmask (Old) and /work/SRC/openSUSE:Factory/.perl-Net-Netmask.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Net-Netmask" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Net-Netmask/perl-Net-Netmask.changes 2015-04-16 14:14:45.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Net-Netmask.new/perl-Net-Netmask.changes 2015-05-06 07:49:40.000000000 +0200 @@ -1,0 +2,12 @@ +Tue May 5 08:31:56 UTC 2015 - [email protected] + +- updated to 1.9022 + see /usr/share/doc/packages/perl-Net-Netmask/Changes + + 1.9022 2015-05-05 + + - Changes from adamherzog: minor cleanups plus + - A bunch of addtional tests + - A couple of small code fixes + +------------------------------------------------------------------- Old: ---- Net-Netmask-1.9021.tar.gz New: ---- Net-Netmask-1.9022.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Net-Netmask.spec ++++++ --- /var/tmp/diff_new_pack.lbLfJE/_old 2015-05-06 07:49:40.000000000 +0200 +++ /var/tmp/diff_new_pack.lbLfJE/_new 2015-05-06 07:49:40.000000000 +0200 @@ -17,7 +17,7 @@ Name: perl-Net-Netmask -Version: 1.9021 +Version: 1.9022 Release: 0 #Upstream: This module may be used, modified and redistributed on the same terms as Perl itself. %define cpan_name Net-Netmask ++++++ Net-Netmask-1.9021.tar.gz -> Net-Netmask-1.9022.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-Netmask-1.9021/Changes new/Net-Netmask-1.9022/Changes --- old/Net-Netmask-1.9021/Changes 2014-07-18 02:09:30.000000000 +0200 +++ new/Net-Netmask-1.9022/Changes 2015-05-05 04:07:11.000000000 +0200 @@ -1,6 +1,12 @@ Revision history for Perl module Net::Netmask +1.9022 2015-05-05 + + - Changes from adamherzog: minor cleanups plus + - A bunch of addtional tests + - A couple of small code fixes + 1.9021 2014-07-17 - Spelling fix in documentation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-Netmask-1.9021/META.json new/Net-Netmask-1.9022/META.json --- old/Net-Netmask-1.9021/META.json 2014-07-18 02:09:59.000000000 +0200 +++ new/Net-Netmask-1.9022/META.json 2015-05-05 04:08:22.000000000 +0200 @@ -40,5 +40,5 @@ "url" : "http://github.com/muir/Net-Netmask" } }, - "version" : "1.9021" + "version" : "1.9022" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-Netmask-1.9021/META.yml new/Net-Netmask-1.9022/META.yml --- old/Net-Netmask-1.9021/META.yml 2014-07-18 02:09:59.000000000 +0200 +++ new/Net-Netmask-1.9022/META.yml 2015-05-05 04:08:22.000000000 +0200 @@ -20,4 +20,4 @@ requires: {} resources: repository: http://github.com/muir/Net-Netmask -version: 1.9021 +version: 1.9022 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-Netmask-1.9021/lib/Net/Netmask.pm new/Net-Netmask-1.9022/lib/Net/Netmask.pm --- old/Net-Netmask-1.9021/lib/Net/Netmask.pm 2014-07-18 02:07:23.000000000 +0200 +++ new/Net-Netmask-1.9022/lib/Net/Netmask.pm 2015-05-05 04:07:11.000000000 +0200 @@ -3,7 +3,7 @@ package Net::Netmask; use vars qw($VERSION); -$VERSION = 1.9021; +$VERSION = 1.9022; require Exporter; @ISA = qw(Exporter); @@ -74,7 +74,7 @@ $error = "illegal netmask: $mask"; } } elsif (($net =~ m,^\d+\.\d+\.\d+\.\d+$,) && - ($mask =~ m,0x[a-z0-9]+,i)) + ($mask =~ m,0x[a-f0-9]+,i)) { $base = $net; my $imask = hex($mask); @@ -118,14 +118,6 @@ carp $error if $error && $debug; - $ibase = quad2int($base || 0) unless defined $ibase; - unless (defined($ibase) || defined($error)) { - $error = "could not parse $net"; - $error .= " $mask" if $mask; - } - $ibase &= $imask[$bits] - if defined $ibase && defined $bits; - $bits = 0 unless $bits; if ($bits > 32) { $error = "illegal number of bits: $bits" @@ -133,6 +125,14 @@ $bits = 32; } + $ibase = quad2int($base || 0) unless defined $ibase; + unless (defined($ibase) || defined($error)) { + $error = "could not parse $net"; + $error .= " $mask" if $mask; + } + $ibase &= $imask[$bits] + if defined $ibase; + return bless { 'IBASE' => $ibase, 'BITS' => $bits, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-Netmask-1.9021/lib/Net/Netmask.pod new/Net-Netmask-1.9022/lib/Net/Netmask.pod --- old/Net-Netmask-1.9021/lib/Net/Netmask.pod 2014-07-18 02:06:28.000000000 +0200 +++ new/Net-Netmask-1.9022/lib/Net/Netmask.pod 2015-05-05 04:08:03.000000000 +0200 @@ -180,7 +180,7 @@ =item ->B<match>($ip) Returns a true if the IP number $ip matches the given network. That -is, a true value is returned if $ip is between base() amd broadcast(). +is, a true value is returned if $ip is between base() and broadcast(). For example, if we have the network 192.168.1.0/24, then 192.168.0.255 => 0 @@ -340,7 +340,7 @@ =head1 OVERLOADING -Overloading doesn't seem to work completeley on perl before version +Overloading doesn't seem to work completely on perl before version 5.6.1. The test suite doesn't test overloading before that. At least for sort. @@ -352,7 +352,7 @@ =item B<cmp> -Numerical and string comparisions have been overloaded to +Numerical and string comparisons have been overloaded to the ->B<cmpblocks>() method. This allows blocks to be sorted without specifying a sort function. @@ -406,7 +406,7 @@ span that range. For example, range2cidrlist('216.240.32.128', '216.240.36.127'), -will return a list of Net::Netmask objects that corrospond to: +will return a list of Net::Netmask objects that correspond to: 216.240.32.128/25 216.240.33.0/24 @@ -417,7 +417,7 @@ C<cidrs2contiglists> will rearrange a list of Net::Netmask objects such that contiguous sets are in sublists and each sublist is -discontigeous with the next. +discontiguous with the next. For example, given a list of Net::Netmask objects corresponding to the following blocks: @@ -451,4 +451,3 @@ This module may be used, modified and redistributed on the same terms as Perl itself. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-Netmask-1.9021/t/badnets.t new/Net-Netmask-1.9022/t/badnets.t --- old/Net-Netmask-1.9021/t/badnets.t 2013-09-21 03:38:31.000000000 +0200 +++ new/Net-Netmask-1.9022/t/badnets.t 2015-05-05 04:07:11.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -BEGIN { $| = 1; print "1..28\n";} +BEGIN { $| = 1; print "1..52\n";} use Net::Netmask; $loaded = 1; print "ok 1\n"; @@ -62,6 +62,39 @@ # test ranges that are a power-of-two big, but are not legal blocks test(27,! Net::Netmask->new2('218.0.0.0 - 221.255.255.255'), "could not find exact fit for 218.0.0.0 - 221.255.255.255"); -test(28,! Net::Netmask->new2('218.0.0.4 - 218.0.0.11'), +test(28,scalar(Net::Netmask->errstr =~ /^could not find exact fit/), + "errstr mismatch"); +test(29,! Net::Netmask->new2('218.0.0.4 - 218.0.0.11'), "could not find exact fit for 218.0.0.4 - 218.0.0.11"); +test(30,scalar(Net::Netmask->errstr =~ /^could not find exact fit/), + "errstr mismatch"); + +# test some more bad nets/masks +test(31,!defined(Net::Netmask->new2('10.10.10.10#256.0.0.0')),"bad mask byte"); +test(32,scalar(Net::Netmask->errstr =~ /^illegal hostmask:/),"errstr mismatch"); +test(33,!defined(Net::Netmask->new2('209.157.200.22','256.255.224.0')), + "bad mask"); +test(34,scalar(Net::Netmask->errstr =~ /^illegal netmask:/),"errstr mismatch"); +test(35,!defined(Net::Netmask->new2('10.10.10.10','0xF')),"bad mask"); +test(36,scalar(Net::Netmask->errstr =~ /^illegal netmask:/),"errstr mismatch"); +test(37,!defined(Net::Netmask->new2('209.200.70.33/33')), "bad mask"); +test(38,scalar(Net::Netmask->errstr =~ /^illegal number of bits:/),"errstr mismatch"); +test(39,!defined(Net::Netmask->new2('209.200.64.0-309.157.95.255')), + "bad mask byte"); +test(40,scalar(Net::Netmask->errstr =~ /^illegal dotted quad/), + "errstr mismatch"); + +# test completely invalid args +test(41,!defined(Net::Netmask->new2('foo')),"bad net"); +test(42,scalar(Net::Netmask->errstr =~ /^could not parse /),"errstr mismatch"); +test(43,!defined(Net::Netmask->new2('10.10.10.10','foo')),"bad mask"); +test(44,scalar(Net::Netmask->errstr =~ /^could not parse /),"errstr mismatch"); +test(45,!defined(Net::Netmask->new2('10.10.10','foo')),"bad mask"); +test(46,scalar(Net::Netmask->errstr =~ /^could not parse /),"errstr mismatch"); +test(47,!defined(Net::Netmask->new2('10.10','foo')),"bad mask"); +test(48,scalar(Net::Netmask->errstr =~ /^could not parse /),"errstr mismatch"); +test(49,!defined(Net::Netmask->new2('10','foo')),"bad mask"); +test(50,scalar(Net::Netmask->errstr =~ /^could not parse /),"errstr mismatch"); +test(51,!defined(Net::Netmask->new2('10.10.10.10','0xYYY')),"bad mask"); +test(52,scalar(Net::Netmask->errstr =~ /^could not parse/),"errstr mismatch"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Net-Netmask-1.9021/t/netmasks.t new/Net-Netmask-1.9022/t/netmasks.t --- old/Net-Netmask-1.9021/t/netmasks.t 2013-09-21 03:38:31.000000000 +0200 +++ new/Net-Netmask-1.9022/t/netmasks.t 2015-05-05 04:07:11.000000000 +0200 @@ -4,7 +4,7 @@ use Net::Netmask qw(sameblock cmpblocks); use Carp; use Carp qw(verbose); -use Test::More tests => 295; +use Test::More tests => 304; # addr mask base newmask bits mb my @rtests = qw( @@ -93,7 +93,7 @@ is(($x->inaddr())[1], 64); is(($x->inaddr())[2], 95); -$x = new Net::Netmask ('default'); +$x = new Net::Netmask ('any'); ok($x->size() == 4294967296); $x = new Net::Netmask ('209.157.64.0/27'); @@ -101,6 +101,10 @@ is($y[0], '209.157.64.0'); is($y[31], '209.157.64.31'); ok(! defined($y[32])); +@y = $x->enumerate(31); +is($y[0], '209.157.64.0'); +is($y[15], '209.157.64.30'); +ok(! defined($y[16])); $x = new Net::Netmask ('10.2.0.16/19'); @y = $x->enumerate(); @@ -157,6 +161,9 @@ is($newmask->nth(-1),'192.168.1.255'); is($newmask->nth(-2),'192.168.1.254'); is($newmask->nth(0),'192.168.1.0'); +is($newmask->nth(1,31),'192.168.1.2'); +is($newmask->nth(256),undef); +is($newmask->nth(-257),undef); ok($newmask->match('192.168.1.1') == 1); ok($newmask->match('192.168.1.100') == 100); @@ -243,6 +250,10 @@ my $dl = dlist(@c); ok($dl eq '66.33.85.239/32 66.33.85.240/32'); +(@c) = range2cidrlist("66.33.85.240", "66.33.85.239"); +$dl = dlist(@c); +ok($dl eq '66.33.85.239/32 66.33.85.240/32'); + (@c) = range2cidrlist('216.240.32.128', '216.240.36.127'); $dl = dlist(@c); ok($dl eq '216.240.32.128/25 216.240.33.0/24 216.240.34.0/23 216.240.36.0/25'); @@ -592,6 +603,12 @@ } { + my $obj1 = new2 Net::Netmask ('217.173.192.0/21'); + ok($obj1->contains("217.173.192.0/24")); + ok(! $obj1->contains("217.173.200.0/21")); +} + +{ my $warnings = ''; local($SIG{__WARN__}) = sub { $warnings = $_[0] }; my $block = findNetblock("127.0.0.", { 1 => []});
