r70973 - in /trunk/libnetaddr-ip-perl: Changes IP.pm Lite/Changes Lite/Lite.pm Lite/README Lite/t/v6-num.t MANIFEST META.yml debian/changelog
periapt-guest at users.alioth.debian.org
periapt-guest at users.alioth.debian.org
Wed Mar 9 16:38:53 UTC 2011
Author: periapt-guest
Date: Wed Mar 9 16:38:42 2011
New Revision: 70973
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=70973
Log:
New upstream release
Added:
trunk/libnetaddr-ip-perl/Lite/t/v6-num.t
- copied unchanged from r70970, branches/upstream/libnetaddr-ip-perl/current/Lite/t/v6-num.t
Modified:
trunk/libnetaddr-ip-perl/Changes
trunk/libnetaddr-ip-perl/IP.pm
trunk/libnetaddr-ip-perl/Lite/Changes
trunk/libnetaddr-ip-perl/Lite/Lite.pm
trunk/libnetaddr-ip-perl/Lite/README
trunk/libnetaddr-ip-perl/MANIFEST
trunk/libnetaddr-ip-perl/META.yml
trunk/libnetaddr-ip-perl/debian/changelog
Modified: trunk/libnetaddr-ip-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnetaddr-ip-perl/Changes?rev=70973&op=diff
==============================================================================
--- trunk/libnetaddr-ip-perl/Changes (original)
+++ trunk/libnetaddr-ip-perl/Changes Wed Mar 9 16:38:42 2011
@@ -1,4 +1,10 @@
Revision history for Perl extension NetAddr::IP
+
+4.041 Tue Mar 8 15:18:16 PST 2011
+ Updated Lite.pm v1.26, "sub num" to support usable IP ranges
+ greater than 2**32
+
+ Thanks to Jan Ploski jan at plosquare.com for finding this bug
4.040 Sat Feb 19 10:04:00 PST 2011
correction to use of Util.pm package lexicals
Modified: trunk/libnetaddr-ip-perl/IP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnetaddr-ip-perl/IP.pm?rev=70973&op=diff
==============================================================================
--- trunk/libnetaddr-ip-perl/IP.pm (original)
+++ trunk/libnetaddr-ip-perl/IP.pm Wed Mar 9 16:38:42 2011
@@ -4,7 +4,7 @@
use strict;
#use diagnostics;
-use NetAddr::IP::Lite 1.25 qw(Zero Zeros Ones V4mask V4net);
+use NetAddr::IP::Lite 1.26 qw(Zero Zeros Ones V4mask V4net);
use NetAddr::IP::Util 1.36 qw(
sub128
inet_aton
@@ -34,7 +34,7 @@
@ISA = qw(Exporter NetAddr::IP::Lite);
-$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.40 $ =~ /\d+/g) };
+$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.41 $ =~ /\d+/g) };
=pod
@@ -1237,13 +1237,31 @@
=item C<-E<gt>num()>
Version 4.00 of NetAddr::IP and version 1.00 of NetAddr::IP::Lite
-Returns the number of usable addresses IP addresses within the
-subnet, not counting the broadcast or network address. Previous versions
-returned th number of IP addresses not counting the broadcast address.
+return the number of usable IP addresses within the subnet,
+not counting the broadcast or network address.
+
+Previous versions worked only for ipV4 addresses, returned a
+maximum span of 2**32 and returned the number of IP addresses
+not counting the broadcast address.
+ (one greater than the new behavior)
To use the old behavior for C<-E<gt>nth($index)> and C<-E<gt>num()>:
use NetAddr::IP::Lite qw(:old_nth);
+
+WARNING:
+
+NetAddr::IP will calculate and return a numeric string for network
+ranges as large as 2**128. These values are TEXT strings and perl
+can treat them as integers for numeric calculations.
+
+Perl on 32 bit platforms only handles integer numbers up to 2**32
+and on 64 bit platforms to 2**64.
+
+If you wish to manipulate numeric strings returned by NetAddr::IP
+that are larger than 2**32 or 2**64, respectively, you must load
+additional modules such as Math::BigInt, bignum or some similar
+package to do the integer math.
=item C<-E<gt>re()>
Modified: trunk/libnetaddr-ip-perl/Lite/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnetaddr-ip-perl/Lite/Changes?rev=70973&op=diff
==============================================================================
--- trunk/libnetaddr-ip-perl/Lite/Changes (original)
+++ trunk/libnetaddr-ip-perl/Lite/Changes Wed Mar 9 16:38:42 2011
@@ -1,4 +1,9 @@
Revision history for Perl extension NetAddr::IP::Lite
+
+1.26 Tue Mar 8 15:18:16 PST 2011
+ Updated "sub num" to support usable IP ranges greater than 2**32
+
+ Thanks to Jan Ploski jan at plosquare.com for finding this bug
1.25 Sat Feb 19 10:04:00 PST 2011
correction to use of Util.pm package lexicals
Modified: trunk/libnetaddr-ip-perl/Lite/Lite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnetaddr-ip-perl/Lite/Lite.pm?rev=70973&op=diff
==============================================================================
--- trunk/libnetaddr-ip-perl/Lite/Lite.pm (original)
+++ trunk/libnetaddr-ip-perl/Lite/Lite.pm Wed Mar 9 16:38:42 2011
@@ -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.25 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+$VERSION = do { my @r = (q$Revision: 1.26 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
require Exporter;
@@ -1210,30 +1210,64 @@
=item C<-E<gt>num()>
Version 4.00 of NetAddr::IP and version 1.00 of NetAddr::IP::Lite
-Returns the number of usable addresses IP addresses within the
-subnet, not counting the broadcast or network address. Previous versions
-returned th number of IP addresses not counting the broadcast address.
+return the number of usable IP addresses within the subnet,
+not counting the broadcast or network address.
+
+Previous versions worked only for ipV4 addresses, returned a
+maximum span of 2**32 and returned the number of IP addresses
+not counting the broadcast address.
+ (one greater than the new behavior)
To use the old behavior for C<-E<gt>nth($index)> and C<-E<gt>num()>:
use NetAddr::IP::Lite qw(:old_nth);
+WARNING:
+
+NetAddr::IP will calculate and return a numeric string for network
+ranges as large as 2**128. These values are TEXT strings and perl
+can treat them as integers for numeric calculations.
+
+Perl on 32 bit platforms only handles integer numbers up to 2**32
+and on 64 bit platforms to 2**64.
+
+If you wish to manipulate numeric strings returned by NetAddr::IP
+that are larger than 2**32 or 2**64, respectively, you must load
+additional modules such as Math::BigInt, bignum or some similar
+package to do the integer math.
+
=cut
sub num ($) {
- my @net = unpack('L3N',$_[0]->{mask} ^ Ones);
if ($Old_nth) {
+ my @net = unpack('L3N',$_[0]->{mask} ^ Ones);
# number of ip's less broadcast
return 0xfffffffe if $net[0] || $net[1] || $net[2]; # 2**32 -1
return $net[3] if $net[3];
} else { # returns 1 for /32 /128, 0 for /31 /127 else n-2 up to 2**32
-# number of usable IP's === number of ip's less broadcast & network addys
- return 0xfffffffd if $net[0] || $net[1] || $net[2]; # 2**32 -2
- return 1 unless $net[3];
- $net[3]--;
+ (undef, my $net) = addconst($_[0]->{mask},1);
+ return 1 unless hasbits($net); # ipV4/32 or ipV6/128
+ $net = $net ^ Ones;
+ return 0 unless hasbits($net); # ipV4/31 or ipV6/127
+ return bin2bcd($net);
}
- return $net[3];
-}
+}
+
+# deprecated
+#sub num ($) {
+# my @net = unpack('L3N',$_[0]->{mask} ^ Ones);
+# if ($Old_nth) {
+## number of ip's less broadcast
+# return 0xfffffffe if $net[0] || $net[1] || $net[2]; # 2**32 -1
+# return $net[3] if $net[3];
+# } else { # returns 1 for /32 /128, 0 for /31 /127 else n-2 up to 2**32
+## number of usable IP's === number of ip's less broadcast & network addys
+# return 0xfffffffd if $net[0] || $net[1] || $net[2]; # 2**32 -2
+# return 1 unless $net[3];
+# $net[3]--;
+# }
+# return $net[3];
+#}
=pod
Modified: trunk/libnetaddr-ip-perl/Lite/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnetaddr-ip-perl/Lite/README?rev=70973&op=diff
==============================================================================
--- trunk/libnetaddr-ip-perl/Lite/README (original)
+++ trunk/libnetaddr-ip-perl/Lite/README Wed Mar 9 16:38:42 2011
@@ -409,14 +409,30 @@
"->num()"
Version 4.00 of NetAddr::IP and version 1.00 of NetAddr::IP::Lite
- Returns the number of usable addresses IP addresses within the
- subnet, not counting the broadcast or network address. Previous
- versions returned th number of IP addresses not counting the
- broadcast address.
+ return the number of usable IP addresses within the subnet, not
+ counting the broadcast or network address.
+
+ Previous versions worked only for ipV4 addresses, returned a maximum
+ span of 2**32 and returned the number of IP addresses not counting
+ the broadcast address. (one greater than the new behavior)
To use the old behavior for "->nth($index)" and "->num()":
use NetAddr::IP::Lite qw(:old_nth);
+
+ WARNING:
+
+ NetAddr::IP will calculate and return a numeric string for network
+ ranges as large as 2**128. These values are TEXT strings and perl
+ can treat them as integers for numeric calculations.
+
+ Perl on 32 bit platforms only handles integer numbers up to 2**32
+ and on 64 bit platforms to 2**64.
+
+ If you wish to manipulate numeric strings returned by NetAddr::IP
+ that are larger than 2**32 or 2**64, respectively, you must load
+ additional modules such as Math::BigInt, bignum or some similar
+ package to do the integer math.
EXPORT_OK
Zeros
Modified: trunk/libnetaddr-ip-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnetaddr-ip-perl/MANIFEST?rev=70973&op=diff
==============================================================================
--- trunk/libnetaddr-ip-perl/MANIFEST (original)
+++ trunk/libnetaddr-ip-perl/MANIFEST Wed Mar 9 16:38:42 2011
@@ -62,6 +62,7 @@
Lite/t/v6-new_cis6_base.t
Lite/t/v6-new_cis_base.t
Lite/t/v6-new-base.t
+Lite/t/v6-num.t
Lite/t/v6-numeric.t
Lite/t/v6-old-base.t
Lite/t/version.t
Modified: trunk/libnetaddr-ip-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnetaddr-ip-perl/META.yml?rev=70973&op=diff
==============================================================================
--- trunk/libnetaddr-ip-perl/META.yml (original)
+++ trunk/libnetaddr-ip-perl/META.yml Wed Mar 9 16:38:42 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: NetAddr-IP
-version: 4.040
+version: 4.041
abstract: Manages IPv4 and IPv6 addresses and subnets
license: ~
author:
Modified: trunk/libnetaddr-ip-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnetaddr-ip-perl/debian/changelog?rev=70973&op=diff
==============================================================================
--- trunk/libnetaddr-ip-perl/debian/changelog (original)
+++ trunk/libnetaddr-ip-perl/debian/changelog Wed Mar 9 16:38:42 2011
@@ -1,3 +1,9 @@
+libnetaddr-ip-perl (4.041+dfsg-1) UNRELEASED; urgency=low
+
+ * New upstream release
+
+ -- Nicholas Bamber <nicholas at periapt.co.uk> Wed, 09 Mar 2011 16:20:45 +0000
+
libnetaddr-ip-perl (4.040+dfsg-1) unstable; urgency=low
* New upstream release
More information about the Pkg-perl-cvs-commits
mailing list