r64396 - in /branches/upstream/libnetaddr-ip-perl/current: Changes IP.pm Lite/Changes Lite/Lite.pm Lite/README Lite/t/bug62521.t Lite/t/v4_new_cis.t Lite/t/v6-new_cis6_base.t Lite/t/v6-new_cis_base.t MANIFEST META.yml

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Fri Oct 29 08:54:17 UTC 2010


Author: periapt-guest
Date: Fri Oct 29 08:53:54 2010
New Revision: 64396

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=64396
Log:
[svn-upgrade] new version libnetaddr-ip-perl (4.035+dfsg)

Added:
    branches/upstream/libnetaddr-ip-perl/current/Lite/t/bug62521.t
    branches/upstream/libnetaddr-ip-perl/current/Lite/t/v4_new_cis.t
    branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis6_base.t
    branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis_base.t
Modified:
    branches/upstream/libnetaddr-ip-perl/current/Changes
    branches/upstream/libnetaddr-ip-perl/current/IP.pm
    branches/upstream/libnetaddr-ip-perl/current/Lite/Changes
    branches/upstream/libnetaddr-ip-perl/current/Lite/Lite.pm
    branches/upstream/libnetaddr-ip-perl/current/Lite/README
    branches/upstream/libnetaddr-ip-perl/current/MANIFEST
    branches/upstream/libnetaddr-ip-perl/current/META.yml

Modified: branches/upstream/libnetaddr-ip-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/Changes?rev=64396&op=diff
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/Changes (original)
+++ branches/upstream/libnetaddr-ip-perl/current/Changes Fri Oct 29 08:53:54 2010
@@ -1,14 +1,27 @@
 Revision history for Perl extension NetAddr::IP
 
+4.035 Thu Oct 28 14:26:19 PDT 2010
+	fix bug in Lite v1.21 where new6 improperly assigns the mask value 
+	for and ipv4 address in 32 bit space instead of 128 bit space
+
+	Thanks to Mark Martinec and Steve Huff (SHUFF) * shuff at cpan.org
+	for spotting and replicating that bug
+
+	added new_cis and new_cis6 to Lite.pm v1.21 to accomodate
+	Cisco syntax that has IP and MASK seperated by a space.
+
+	Updated typo in documentation that left out example
+	print new6 stuff
+
 4.034 Mon Oct 25 16:22:01 PDT 2010
-        Updated Lite::_xnew v1.20 to properly handle ipV6 notation of the form
-        xxxx:xxxx:xxxx:xxxx:xxxx:xxxx, DDD
-
-        Thanks to Dusty Mabe <Dusty.Mabe at tekelec.com> for spotting this bug
+	Updated Lite::_xnew v1.20 to properly handle ipV6 notation of the form
+	xxxx:xxxx:xxxx:xxxx:xxxx:xxxx, DDD
+
+	Thanks to Dusty Mabe <Dusty.Mabe at tekelec.com> for spotting this bug
 
 4.033  Wed Sep 29 10:32:50 PDT 2010
-        Conditionalize import of AF_INET6 in Util.pm
-        NetAddr::IP::UtilPolluted
+	Conditionalize import of AF_INET6 in Util.pm
+	NetAddr::IP::UtilPolluted
 
 4.032  Wed Sep 22 13:39:08 PDT 2010
 	Added overload => 'ne' and '!=' to Lite.pm v1.18
@@ -18,15 +31,15 @@
 	NetAddr::IP::Util.pm 1.33 in its own namespace
 
 4.030  Tue Jul 20 15:32:23 PDT 2010
-        Resolve named hosts in Lite.pm using gethostbyname, followed by 
+	Resolve named hosts in Lite.pm using gethostbyname, followed by 
 	gethostbyname6 to determine whether to set ipV6 flag
 
-        Thanks to Dusty Mabe <Dusty.Mabe at tekelec.com> for spotting this bug
+	Thanks to Dusty Mabe <Dusty.Mabe at tekelec.com> for spotting this bug
 
 4.029  Thu Jul  8 18:17:38 PDT 2010
 	In NetAddr::IP::Lite,
-        added support for the sub "new" to resolve host6 names
-        if the OPTIONAL perl Socket6 module is available
+	added support for the sub "new" to resolve host6 names
+	if the OPTIONAL perl Socket6 module is available
 
 	Thanks to "Mabe, Dusty" <Dusty.Mabe at tekelec.com> for spotting 
 	this and suggesting a fix.
@@ -43,13 +56,13 @@
 
 4.027  Tue Jun  9 10:31:11 PDT 2009
 	In NetAddr::IP::Util v1.31,
-        ferret out shell value for Makefile.PL when calling
-        ./configure for systems where the 'x' bit gets lost
-        due to bug in Archive::Tar
+	ferret out shell value for Makefile.PL when calling
+	./configure for systems where the 'x' bit gets lost
+	due to bug in Archive::Tar
 
 4.026  Sat Mar  7 16:35:33 PST 2009
-        make the compiler test check the environment for
-        CC before using Perl's default compiler
+	make the compiler test check the environment for
+	CC before using Perl's default compiler
 
 4.025  Sat Mar  7 16:15:18 PST 2009
 	revised compiler test in Makefile.PL for Util v1.29

Modified: branches/upstream/libnetaddr-ip-perl/current/IP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/IP.pm?rev=64396&op=diff
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/IP.pm (original)
+++ branches/upstream/libnetaddr-ip-perl/current/IP.pm Fri Oct 29 08:53:54 2010
@@ -4,7 +4,7 @@
 
 use strict;
 #use diagnostics;
-use NetAddr::IP::Lite 1.19 qw(Zero Zeros Ones V4mask V4net);
+use NetAddr::IP::Lite 1.21 qw(Zero Zeros Ones V4mask V4net);
 use NetAddr::IP::Util 1.34 qw(
 	sub128
 	inet_aton
@@ -34,7 +34,7 @@
 
 @ISA = qw(Exporter NetAddr::IP::Lite);
 
-$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.34 $ =~ /\d+/g) };
+$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.35 $ =~ /\d+/g) };
 
 =pod
 
@@ -60,7 +60,7 @@
   );
 
   NOTE: NetAddr::IP::Util has a full complement of network address
-	utilites to convert back and from from binary to text.
+	utilites to convert back and forth between binary and text.
 
 	inet_aton, inet_ntoa, ipv6_aton, ipv6_n2x, ipv6_n2d
 	inet_any2d, inet_n2dx, inet_n2ad, inetanyto6, ipv6to4
@@ -471,27 +471,40 @@
 
 =item C<-E<gt>new_from_aton($netaddr)>
 
+=item C<-E<gt>new_cis("$addr $mask)>
+
+=item C<-E<gt>new_cis6("$addr $mask)>
+
 The first two methods create a new address with the supplied address in
-C<$addr> and an optional netmask C<$mask>, which can be omitted to get
-a /32 or /128 netmask for IPv4 / IPv6 addresses respectively
-
-B<new_from_aton> takes a packed IPv4 address and assumes a /32 mask. This
-function replaces the DEPRECATED :aton functionality which is fundamentally
-broken.
+C<$addr> and an optional netmask C<$mask>, which can be omitted to get 
+a /32 or /128 netmask for IPv4 / IPv6 addresses respectively.
 
 The third method C<new_no> is exclusively for IPv4 addresses and filters
 improperly formatted
 dot quad strings for leading 0's that would normally be interpreted as octal
 format by NetAddr per the specifications for inet_aton.
 
-C<-E<gt>new6> marks the address as being in ipV6 address space even if the
-format would suggest otherwise.
-
-  i.e.	->new6('1.2.3.4') will result in ::102:304
+B<new_from_aton> takes a packed IPv4 address and assumes a /32 mask. This
+function replaces the DEPRECATED :aton functionality which is fundamentally
+broken.
+
+The last two methods B<new_cis> and B<new_cis6> differ from B<new> and
+B<new6> only in that they except the common Cisco address notation for
+address/mask pairs with a B<space> as a seperator instead of a slash (/)
+
+  i.e.  ->new_cis('1.2.3.0 24')
+        or
+        ->new_cis6('::1.2.3.0 120')
+
+C<-E<gt>new6> and
+C<-E<gt>new_cis6> mark the address as being in ipV6 address space even
+if the format would suggest otherwise.
+
+  i.e.  ->new6('1.2.3.4') will result in ::102:304
 
   addresses submitted to ->new in ipV6 notation will
   remain in that notation permanently. i.e.
-	->new('::1.2.3.4') will result in ::102:304
+        ->new('::1.2.3.4') will result in ::102:304
   whereas new('1.2.3.4') would print out as 1.2.3.4
 
   See "STRINGIFICATION" below.

Modified: branches/upstream/libnetaddr-ip-perl/current/Lite/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/Lite/Changes?rev=64396&op=diff
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/Lite/Changes (original)
+++ branches/upstream/libnetaddr-ip-perl/current/Lite/Changes Fri Oct 29 08:53:54 2010
@@ -1,4 +1,17 @@
 Revision history for Perl extension NetAddr::IP::Lite
+
+1.21  Thu Oct 28 14:26:19 PDT 2010
+	fix bug where new6 improperly assigns the mask value 
+	for and ipv4 address in 32 bit space instead of 128 bit space
+
+	Thanks to Mark Martinec and Steve Huff (SHUFF) * shuff at cpan.org
+	for spotting and replicating that bug
+
+	added new_cis and new_cis6 to Lite.pm v1.21 to accomodate
+	Cisco syntax that has IP and MASK seperated by a space.
+
+	Updated typo in documentation that left out example
+	print new6 stuff
 
 1.20  Mon Oct 25 16:22:01 PDT 2010
 	Updated _xnew to properly handle ipV6 notation of the form
@@ -7,8 +20,8 @@
 	Thanks to Dusty Mabe <Dusty.Mabe at tekelec.com> for spotting this bug
 
 1.19  Wed Sep 29 10:32:50 PDT 2010
-        Conditionalize import of AF_INET6 in Util.pm
-        NetAddr::IP::UtilPolluted
+	Conditionalize import of AF_INET6 in Util.pm
+	NetAddr::IP::UtilPolluted
 
 1.18  Wed Sep 22 13:39:08 PDT 2010
 	Added overload => 'ne' and '!=' to Lite.pm

Modified: branches/upstream/libnetaddr-ip-perl/current/Lite/Lite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/Lite/Lite.pm?rev=64396&op=diff
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/Lite/Lite.pm (original)
+++ branches/upstream/libnetaddr-ip-perl/current/Lite/Lite.pm Fri Oct 29 08:53:54 2010
@@ -29,7 +29,7 @@
 
 use vars qw(@ISA @EXPORT_OK $VERSION $Accept_Binary_IP $Old_nth $AUTOLOAD *Zero);
 
-$VERSION = do { my @r = (q$Revision: 1.20 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+$VERSION = do { my @r = (q$Revision: 1.21 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
 
 require Exporter;
 
@@ -292,7 +292,7 @@
 	my $ip = new6 NetAddr::IP::Lite '192.168.1.123';
 	print "$ip\n";
 
-Will print the string
+Will print the string 0:0:0:0:0:0:C0A8:17B/128
 
 =item B<Equality>
 
@@ -481,8 +481,12 @@
 
 =item C<-E<gt>new_from_aton($netaddr)>
 
+=item C<-E<gt>new_cis("$addr $mask)>
+
+=item C<-E<gt>new_cis6("$addr $mask)>
+
 The first two methods create a new address with the supplied address in
-C<$addr> and an optional netmask C<$mask>, which can be omitted to get
+C<$addr> and an optional netmask C<$mask>, which can be omitted to get 
 a /32 or /128 netmask for IPv4 / IPv6 addresses respectively.
 
 The third method C<new_no> is exclusively for IPv4 addresses and filters
@@ -494,14 +498,23 @@
 function replaces the DEPRECATED :aton functionality which is fundamentally
 broken.
 
-C<-E<gt>new6> marks the address as being in ipV6 address space even if the
-format would suggest otherwise.
-
-  i.e.	->new6('1.2.3.4') will result in ::102:304
+The last two methods B<new_cis> and B<new_cis6> differ from B<new> and
+B<new6> only in that they except the common Cisco address notation for
+address/mask pairs with a B<space> as a seperator instead of a slash (/)
+
+  i.e.  ->new_cis('1.2.3.0 24')
+        or
+        ->new_cis6('::1.2.3.0 120')
+
+C<-E<gt>new6> and
+C<-E<gt>new_cis6> mark the address as being in ipV6 address space even
+if the format would suggest otherwise.
+
+  i.e.  ->new6('1.2.3.4') will result in ::102:304
 
   addresses submitted to ->new in ipV6 notation will
   remain in that notation permanently. i.e.
-	->new('::1.2.3.4') will result in ::102:304
+        ->new('::1.2.3.4') will result in ::102:304
   whereas new('1.2.3.4') would print out as 1.2.3.4
 
   See "STRINGIFICATION" below.
@@ -638,6 +651,24 @@
   goto &_xnew;
 }
 
+sub new_cis($;$$) {
+  my @in = @_;
+  if ( $in[1] && $in[1] =~ m!^(.+)\s+(.+)$! ) {
+    $in[1] = $1 .'/'. $2;
+  }
+  @_ = (0, at in);
+  goto &_xnew;
+}
+
+sub new_cis6($;$$) {
+  my @in = @_;
+  if ( $in[1] && $in[1] =~ m!^(.+)\s+(.+)$! ) {
+    $in[1] = $1 .'/'. $2;
+  }
+  @_ = (1, at in);
+  goto &_xnew;
+}
+
 sub _no_octal {
   $_[0] =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
   return sprintf("%d.%d.%d.%d",$1,$2,$3,$4);
@@ -694,24 +725,28 @@
 
 # parse mask
     if ($mask =~ /^(\d+)$/) {
+      my $mval = $1;
       if (! $isV6 && index($ip,':') < 0) {	# is ipV4
-	if ($1 == 32) {				# cidr 32
+	if ($mval == 32) {				# cidr 32
 	  $mask = Ones;
 	}
 	elsif ($mask < 32) {			# small cidr
-	  $mask = shiftleft(Ones,32 -$1);
+	  $mask = shiftleft(Ones,32 -$mval);
 	} else {				# is a binary mask
-	  $mask = pack('L3N',0xffffffff,0xffffffff,0xffffffff,$1);
+	  $mask = pack('L3N',0xffffffff,0xffffffff,0xffffffff,$mval);
 	}
       } else {					# is ipV6
 	$isV6	= 1;
-	if ($1 == 128) {			# cidr 128
+	if ($mval == 128) {			# cidr 128
 	  $mask = Ones;
 	}
+	elsif ($ip =~ /^\d+\.\d+\.\d+\.\d+$/) {	# corner case of ipV4 with new6
+	  $mask = shiftleft(Ones,32 -$mval);
+	}
 	elsif ($mask < 128) {			# small cidr
-	  $mask = shiftleft(Ones,128 -$1);
+	  $mask = shiftleft(Ones,128 -$mval);
 	} else {				# is a binary mask
-	  $mask = bcd2bin($1);
+	  $mask = bcd2bin($mval);
 	}
       }
     } elsif ($mask =~ m/^\d+\.\d+\.\d+\.\d+$/) { # ipv4 form of mask

Modified: branches/upstream/libnetaddr-ip-perl/current/Lite/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/Lite/README?rev=64396&op=diff
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/Lite/README (original)
+++ branches/upstream/libnetaddr-ip-perl/current/Lite/README Fri Oct 29 08:53:54 2010
@@ -88,7 +88,7 @@
                 my $ip = new6 NetAddr::IP::Lite '192.168.1.123';
                 print "$ip\n";
 
-        Will print the string
+        Will print the string 0:0:0:0:0:0:C0A8:17B/128
 
     Equality
         You can test for equality with either "eq", "ne", "==" or "!=".
@@ -165,6 +165,8 @@
     "->new6([$addr, [ $mask]])"
     "->new_no([$addr, [ $mask]])"
     "->new_from_aton($netaddr)"
+    "->new_cis("$addr $mask)"
+    "->new_cis6("$addr $mask)"
         The first two methods create a new address with the supplied address
         in "$addr" and an optional netmask "$mask", which can be omitted to
         get a /32 or /128 netmask for IPv4 / IPv6 addresses respectively.
@@ -178,8 +180,17 @@
         This function replaces the DEPRECATED :aton functionality which is
         fundamentally broken.
 
-        "->new6" marks the address as being in ipV6 address space even if
-        the format would suggest otherwise.
+        The last two methods new_cis and new_cis6 differ from new and new6
+        only in that they except the common Cisco address notation for
+        address/mask pairs with a space as a seperator instead of a slash
+        (/)
+
+          i.e.  ->new_cis('1.2.3.0 24')
+                or
+                ->new_cis6('::1.2.3.0 120')
+
+        "->new6" and "->new_cis6" mark the address as being in ipV6 address
+        space even if the format would suggest otherwise.
 
           i.e.  ->new6('1.2.3.4') will result in ::102:304
 

Added: branches/upstream/libnetaddr-ip-perl/current/Lite/t/bug62521.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/Lite/t/bug62521.t?rev=64396&op=file
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/Lite/t/bug62521.t (added)
+++ branches/upstream/libnetaddr-ip-perl/current/Lite/t/bug62521.t Fri Oct 29 08:53:54 2010
@@ -1,0 +1,23 @@
+
+BEGIN { $| = 1; print "1..2\n"; }
+END {print "not ok 1\n" unless $loaded;}
+
+$loaded = 1;
+print "ok 1\n";
+
+#use diagnostics;
+use NetAddr::IP::Lite;
+
+$| = 1;
+
+my $test = 2;
+
+sub ok() {
+  print 'ok ',$test++,"\n";
+}
+
+$exp = '0:0:0:0:0:0:7F00:0/104';
+my $ip = new6 NetAddr::IP::Lite('127.0.0.0/8');
+print "exp $exp\ngot ", $ip, "\nnot "
+	unless $ip eq $exp;
+&ok;

Added: branches/upstream/libnetaddr-ip-perl/current/Lite/t/v4_new_cis.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/Lite/t/v4_new_cis.t?rev=64396&op=file
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/Lite/t/v4_new_cis.t (added)
+++ branches/upstream/libnetaddr-ip-perl/current/Lite/t/v4_new_cis.t Fri Oct 29 08:53:54 2010
@@ -1,0 +1,68 @@
+#use diagnostics;
+use NetAddr::IP::Lite;
+
+use Test::More;
+
+my $binword;
+{
+  local $SIG{__WARN__} = sub {};
+  $binword = eval "0b11111111111111110000000000000000";
+}
+if ($@) {
+  $binword = 0xffff0000;
+  print STDERR "\t\tskipped! 0b11111111111111110000000000000000\n\t\tbinary bit strings unsupported in Perl version $]\n";
+}
+
+ at a = (
+	  [ 'localhost', '127.0.0.1' ],
+	  [ 0x01010101, '1.1.1.1' ],
+	  [ 1, '1.0.0.0' ],	# Because it will have a mask. 0.0.0.1 ow
+	  [ 'default', '0.0.0.0' ],
+	  [ 'any', '0.0.0.0' ],
+	  [-809041407, '207.199.2.1'],
+	  [3485925889, '207.199.2.1'],
+);
+
+ at m = (
+	 [ 0, '0.0.0.0' ],
+	 [ 1, '128.0.0.0' ],
+	 [ 2, '192.0.0.0' ],
+	 [ 4, '240.0.0.0' ],
+	 [ 8, '255.0.0.0' ],
+	 [ 16, '255.255.0.0' ],
+	 [ 17, '255.255.128.0' ],
+	 [ 24, '255.255.255.0' ],
+	 [ 'default', '0.0.0.0' ],
+	 [ 32, '255.255.255.255' ],
+	 [ 'host', '255.255.255.255' ],
+	 [ 0xffffff00, '255.255.255.0' ],
+	 [ '255.255.255.240', '255.255.255.240' ],
+	 [ '255.255.128.0', '255.255.128.0' ],
+	 [ $binword, '255.255.0.0' ],
+);
+
+plan tests => (4 * scalar @a * scalar @m) + 4;
+
+foreach my $invalid qw(
+	256.1.1.1
+	256.256.1.1
+	256.256.256.1
+	256.256.256.256
+) {
+  ok (! defined NetAddr::IP::Lite->new($invalid), "Invalid IP $invalid returns undef");
+}
+
+for my $a (@a) {
+    for my $m (@m) {
+	my $ip = new_cis NetAddr::IP::Lite "$a->[0] $m->[0]";
+      SKIP:
+	{
+	    skip "Failed to make an object for $a->[0]/$m->[0]", 4
+		unless defined $ip;
+	    is($ip->addr, $a->[1], "$a->[0] / $m->[0] is $a->[1]");
+	    is($ip->mask, $m->[1], "$a->[0] / $m->[0] is $m->[1]");
+	    is($ip->bits, 32, "$a->[0] / $m->[0] is 32 bits wide");
+	    is($ip->version, 4, "$a->[0] / $m->[0] is version 4");
+	};
+    }
+}

Added: branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis6_base.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis6_base.t?rev=64396&op=file
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis6_base.t (added)
+++ branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis6_base.t Fri Oct 29 08:53:54 2010
@@ -1,0 +1,69 @@
+# This -*- perl -*- code excercises the basic v6 functionality
+
+sub mypass() {1}
+sub myfail() {0}
+
+ at addr =
+    (
+     ['::',  3, '0:0:0:0:0:0:0:0/128',myfail],
+     ['::1', 3, '0:0:0:0:0:0:0:1/128',myfail],
+     ['F34::123 40', 2, 'F34:0:0:0:0:0:0:3/40',mypass],
+     ['DEAD:BEEF::1 40', 2, 'DEAD:BEEF:0:0:0:0:0:3/40',mypass],
+     ['1000::2 40', 0, '1000:0:0:0:0:0:0:1/40',mypass],
+     ['1000::2000 40', 0, '1000:0:0:0:0:0:0:1/40',mypass],
+     ['DEAD::CAFE 40', 0, 'DEAD:0:0:0:0:0:0:1/40',mypass],
+     ['DEAD:BEEF::1 40', 3, 'DEAD:BEEF:0:0:0:0:0:4/40',mypass],
+     ['DEAD:BEEF::1 40', 4, 'DEAD:BEEF:0:0:0:0:0:5/40',mypass],
+     ['DEAD:BEEF::1 40', 5, 'DEAD:BEEF:0:0:0:0:0:6/40',mypass],
+     ['DEAD:BEEF::1 40', 6, 'DEAD:BEEF:0:0:0:0:0:7/40',mypass],
+     ['DEAD:BEEF::1 40', 7, 'DEAD:BEEF:0:0:0:0:0:8/40',mypass],
+     ['DEAD:BEEF::1 40', 8, 'DEAD:BEEF:0:0:0:0:0:9/40',mypass],
+     ['DEAD:BEEF::1 40', 254, 'DEAD:BEEF:0:0:0:0:0:FF/40',mypass],
+     ['DEAD:BEEF::1 40', 255, 'DEAD:BEEF:0:0:0:0:0:100/40',mypass],
+     ['DEAD:BEEF::1 40', 256, 'DEAD:BEEF:0:0:0:0:0:101/40',mypass],
+     ['DEAD:BEEF::1 40', 65535, 'DEAD:BEEF:0:0:0:0:1:0/40',mypass],
+     ['DEAD:BEEF::1 40', 65536, 'DEAD:BEEF:0:0:0:0:1:1/40',mypass],
+     ['2001:620:0:4::/64', 0, '2001:620:0:4:0:0:0:1/64',mypass],
+     ['3FFE:2000:0:4::/64', 0, '3FFE:2000:0:4:0:0:0:1/64',mypass],
+     ['2001:620:600::1', 0, '2001:620:600:0:0:0:0:1/128',mypass],
+     ['2001:620:600:0:1::1', 0,'2001:620:600:0:1:0:0:1/128',mypass],
+     );
+
+use NetAddr::IP::Lite;
+use Test::More;
+
+my($a, $ip, $test);
+
+$test = 4 * @addr + 4;
+plan tests => $test;
+
+$test = 1;
+
+sub tst {
+  for $a (@addr) {
+	$ip = new_cis6 NetAddr::IP::Lite $a->[0];
+	$a->[0] =~ s,/\d+,,;
+	isa_ok($ip, 'NetAddr::IP::Lite', "$a->[0] ");
+# requires full NetAddr::IP
+#	is(uc $ip->short, $a->[0], "short returns $a->[0]");
+	is($ip->bits, 128, "bits == 128");
+	is($ip->version, 6, "version == 6");
+	my $index = $a->[1];
+	if ($a->[3]) {
+	  is(uc $ip->nth($index), $a->[2], "nth $a->[0], $index");
+	} else {
+	  ok(!$ip->nth($index),"nth $a->[0], undef");
+	}
+ }
+}
+
+tst();
+
+$test = new_cis6 NetAddr::IP::Lite 'f34::1';
+isa_ok($test, 'NetAddr::IP::Lite');
+ok($test->network->contains($test), "->contains");
+
+$test = new_cis6 NetAddr::IP::Lite 'f35::1 40';
+isa_ok($test, 'NetAddr::IP::Lite');
+ok($test->network->contains($test), "->contains");
+

Added: branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis_base.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis_base.t?rev=64396&op=file
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis_base.t (added)
+++ branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-new_cis_base.t Fri Oct 29 08:53:54 2010
@@ -1,0 +1,69 @@
+# This -*- perl -*- code excercises the basic v6 functionality
+
+sub mypass() {1}
+sub myfail() {0}
+
+ at addr =
+    (
+     ['::',  3, '0:0:0:0:0:0:0:0/128',myfail],
+     ['::1', 3, '0:0:0:0:0:0:0:1/128',myfail],
+     ['F34::123 40', 2, 'F34:0:0:0:0:0:0:3/40',mypass],
+     ['DEAD:BEEF::1 40', 2, 'DEAD:BEEF:0:0:0:0:0:3/40',mypass],
+     ['1000::2 40', 0, '1000:0:0:0:0:0:0:1/40',mypass],
+     ['1000::2000 40', 0, '1000:0:0:0:0:0:0:1/40',mypass],
+     ['DEAD::CAFE 40', 0, 'DEAD:0:0:0:0:0:0:1/40',mypass],
+     ['DEAD:BEEF::1 40', 3, 'DEAD:BEEF:0:0:0:0:0:4/40',mypass],
+     ['DEAD:BEEF::1 40', 4, 'DEAD:BEEF:0:0:0:0:0:5/40',mypass],
+     ['DEAD:BEEF::1 40', 5, 'DEAD:BEEF:0:0:0:0:0:6/40',mypass],
+     ['DEAD:BEEF::1 40', 6, 'DEAD:BEEF:0:0:0:0:0:7/40',mypass],
+     ['DEAD:BEEF::1 40', 7, 'DEAD:BEEF:0:0:0:0:0:8/40',mypass],
+     ['DEAD:BEEF::1 40', 8, 'DEAD:BEEF:0:0:0:0:0:9/40',mypass],
+     ['DEAD:BEEF::1 40', 254, 'DEAD:BEEF:0:0:0:0:0:FF/40',mypass],
+     ['DEAD:BEEF::1 40', 255, 'DEAD:BEEF:0:0:0:0:0:100/40',mypass],
+     ['DEAD:BEEF::1 40', 256, 'DEAD:BEEF:0:0:0:0:0:101/40',mypass],
+     ['DEAD:BEEF::1 40', 65535, 'DEAD:BEEF:0:0:0:0:1:0/40',mypass],
+     ['DEAD:BEEF::1 40', 65536, 'DEAD:BEEF:0:0:0:0:1:1/40',mypass],
+     ['2001:620:0:4::/64', 0, '2001:620:0:4:0:0:0:1/64',mypass],
+     ['3FFE:2000:0:4::/64', 0, '3FFE:2000:0:4:0:0:0:1/64',mypass],
+     ['2001:620:600::1', 0, '2001:620:600:0:0:0:0:1/128',mypass],
+     ['2001:620:600:0:1::1', 0,'2001:620:600:0:1:0:0:1/128',mypass],
+     );
+
+use NetAddr::IP::Lite;
+use Test::More;
+
+my($a, $ip, $test);
+
+$test = 4 * @addr + 4;
+plan tests => $test;
+
+$test = 1;
+
+sub tst {
+  for $a (@addr) {
+	$ip = new_cis NetAddr::IP::Lite $a->[0];
+	$a->[0] =~ s,/\d+,,;
+	isa_ok($ip, 'NetAddr::IP::Lite', "$a->[0] ");
+# requires full NetAddr::IP
+#	is(uc $ip->short, $a->[0], "short returns $a->[0]");
+	is($ip->bits, 128, "bits == 128");
+	is($ip->version, 6, "version == 6");
+	my $index = $a->[1];
+	if ($a->[3]) {
+	  is(uc $ip->nth($index), $a->[2], "nth $a->[0], $index");
+	} else {
+	  ok(!$ip->nth($index),"nth $a->[0], undef");
+	}
+ }
+}
+
+tst();
+
+$test = new_cis NetAddr::IP::Lite 'f34::1';
+isa_ok($test, 'NetAddr::IP::Lite');
+ok($test->network->contains($test), "->contains");
+
+$test = new_cis NetAddr::IP::Lite 'f35::1 40';
+isa_ok($test, 'NetAddr::IP::Lite');
+ok($test->network->contains($test), "->contains");
+

Modified: branches/upstream/libnetaddr-ip-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/MANIFEST?rev=64396&op=diff
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/MANIFEST (original)
+++ branches/upstream/libnetaddr-ip-perl/current/MANIFEST Fri Oct 29 08:53:54 2010
@@ -10,6 +10,7 @@
 Lite/t/bigints.t
 Lite/t/bits.t
 Lite/t/broadcast.t
+Lite/t/bug62521.t
 Lite/t/cidr.t
 Lite/t/constants.t
 Lite/t/contains.t
@@ -46,6 +47,7 @@
 Lite/t/v4-new-first.t
 Lite/t/v4-new_from_aton.t
 Lite/t/v4-new.t
+Lite/t/v4_new_cis.t
 Lite/t/v4-no_octal.t
 Lite/t/v4-num.t
 Lite/t/v4-numeric.t
@@ -55,6 +57,8 @@
 Lite/t/v4-wnew.t
 Lite/t/v6-contains.t
 Lite/t/v6-inc.t
+Lite/t/v6-new_cis6_base.t
+Lite/t/v6-new_cis_base.t
 Lite/t/v6-new-base.t
 Lite/t/v6-numeric.t
 Lite/t/v6-old-base.t

Modified: branches/upstream/libnetaddr-ip-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnetaddr-ip-perl/current/META.yml?rev=64396&op=diff
==============================================================================
--- branches/upstream/libnetaddr-ip-perl/current/META.yml (original)
+++ branches/upstream/libnetaddr-ip-perl/current/META.yml Fri Oct 29 08:53:54 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                NetAddr-IP
-version:             4.034
+version:             4.035
 abstract:            Manages IPv4 and IPv6 addresses and subnets
 license:             ~
 author:              




More information about the Pkg-perl-cvs-commits mailing list