diff --git a/Changes b/Changes index 220a568..30c5d54 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,13 @@ Revision history for Perl extension NetAddr::IP +4.038 Fri Dec 17 17:47:47 PST 2010 + Modify subs "new" and "new6" in Lite.pm to accomodate + Cisco mask syntax that uses space instead of "/" for a separator + This eliminates the need for "new_cis" and "newcis6" which are now + deprecated. + + Modify LIte/t/v4-cnew.t and add Lite/t/v6-cnew.t to test the above + 4.037 Fri Nov 19 10:48:01 PST 2010 add :upper and :lower to Lite.pm v1.23 add comments about rfc5952 requirement for lowercase ipV6 notation diff --git a/IP.pm b/IP.pm index 388ff49..3006f7a 100644 --- a/IP.pm +++ b/IP.pm @@ -4,7 +4,7 @@ use strict; #use diagnostics; -use NetAddr::IP::Lite 1.23 qw(Zero Zeros Ones V4mask V4net); +use NetAddr::IP::Lite 1.24 qw(Zero Zeros Ones V4mask V4net); use NetAddr::IP::Util 1.35 qw( sub128 inet_aton @@ -34,7 +34,7 @@ @ISA = qw(Exporter NetAddr::IP::Lite); -$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.37 $ =~ /\d+/g) }; +$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.38 $ =~ /\d+/g) }; =pod @@ -481,6 +481,8 @@ =item C<-Enew_from_aton($netaddr)> +=item new_cis and new_cis6 are DEPRECATED + =item C<-Enew_cis("$addr $mask)> =item C<-Enew_cis6("$addr $mask)> @@ -502,6 +504,9 @@ B only in that they except the common Cisco address notation for address/mask pairs with a B as a separator instead of a slash (/) +These methods are DEPRECATED because the functionality is now included +in the other "new" methods + i.e. ->new_cis('1.2.3.0 24') or ->new_cis6('::1.2.3.0 120') diff --git a/Lite/Changes b/Lite/Changes index 5d61d14..c835dc4 100644 --- a/Lite/Changes +++ b/Lite/Changes @@ -1,5 +1,13 @@ Revision history for Perl extension NetAddr::IP::Lite +1.24 Fri Dec 17 17:47:47 PST 2010 + Modify subs "new" and "new6" to accomodate + Cisco mask syntax that uses space instead of "/" for a separator + This eliminates the need for "new_cis" and "newcis6" which are now + deprecated. + + Modify t/v4-cnew.t and add t/v6-cnew.t to test the above + 1.23 Fri Nov 19 10:48:01 PST 2010 add :upper and :lower to Lite.pm v1.23 add comments about rfc5952 requirement for lowercase ipV6 notation diff --git a/Lite/Lite.pm b/Lite/Lite.pm index cfcb36b..ea1407e 100644 --- a/Lite/Lite.pm +++ b/Lite/Lite.pm @@ -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.23 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +$VERSION = do { my @r = (q$Revision: 1.24 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; require Exporter; @@ -503,6 +503,8 @@ =item C<-Enew_from_aton($netaddr)> +=item new_cis and new_cis6 are DEPRECATED + =item C<-Enew_cis("$addr $mask)> =item C<-Enew_cis6("$addr $mask)> @@ -524,6 +526,9 @@ B only in that they except the common Cisco address notation for address/mask pairs with a B as a separator instead of a slash (/) +These methods are DEPRECATED because the functionality is now included +in the other "new" methods + i.e. ->new_cis('1.2.3.0 24') or ->new_cis6('::1.2.3.0 120') @@ -568,11 +573,15 @@ n.n n.n/mm + n.n mm n.n.n n.n.n/mm + n.n.n mm n.n.n.n n.n.n.n/mm 32 bit cidr notation + n.n.n.n mm n.n.n.n/m.m.m.m + n.n.n.n m.m.m.m loopback, localhost, broadcast, any, default x.x.x.x/host 0xABCDEF, 0b111111000101011110, (or a bcd number) @@ -712,7 +721,8 @@ while (1) { unless (@_) { - if ($ip =~ m!^(.+)/(.+)$!) { +# if ($ip =~ m!^(.+)/(.+)$!) { + if ($ip =~ m!^([a-z0-9.:-]+)(?:/|\s+)([a-z0-9.:-]+)$!) { $ip = $1; $mask = $2; } elsif (grep($ip eq $_,qw(default any broadcast loopback unspecified))) { diff --git a/Lite/README b/Lite/README index b0a821b..8f6448f 100644 --- a/Lite/README +++ b/Lite/README @@ -187,6 +187,7 @@ "->new6([$addr, [ $mask]])" "->new_no([$addr, [ $mask]])" "->new_from_aton($netaddr)" + new_cis and new_cis6 are DEPRECATED "->new_cis("$addr $mask)" "->new_cis6("$addr $mask)" The first two methods create a new address with the supplied address @@ -207,6 +208,9 @@ address/mask pairs with a space as a separator instead of a slash (/) + These methods are DEPRECATED because the functionality is now + included in the other "new" methods + i.e. ->new_cis('1.2.3.0 24') or ->new_cis6('::1.2.3.0 120') @@ -250,11 +254,15 @@ n.n n.n/mm + n.n mm n.n.n n.n.n/mm + n.n.n mm n.n.n.n n.n.n.n/mm 32 bit cidr notation + n.n.n.n mm n.n.n.n/m.m.m.m + n.n.n.n m.m.m.m loopback, localhost, broadcast, any, default x.x.x.x/host 0xABCDEF, 0b111111000101011110, (or a bcd number) diff --git a/Lite/t/v4-cnew.t b/Lite/t/v4-cnew.t index 34258ff..9cb2d7c 100644 --- a/Lite/t/v4-cnew.t +++ b/Lite/t/v4-cnew.t @@ -5,6 +5,10 @@ [ '127.1/16', '127.1.0.0/16' ], [ '10.10.10', '10.10.0.10/32' ], [ '10.10.10/24', '10.10.10.0/24' ], +# include test for cisco syntax using space instead of '/' + [ '127.1 16', '127.1.0.0/16' ], + [ '10.10.10 24', '10.10.10.0/24' ], + [ '10.10.10 255.255.255.0', '10.10.10.0/24' ], ); $| = 1; diff --git a/Lite/t/v6-cnew.t b/Lite/t/v6-cnew.t new file mode 100644 index 0000000..9becdab --- /dev/null +++ b/Lite/t/v6-cnew.t @@ -0,0 +1,27 @@ +use NetAddr::IP::Lite; + +my @subnets = ( + [ 'dead:beef:1234::/16', 'DEAD:BEEF:1234:0:0:0:0:0/16' ], + [ '::1234:BEEF:DEAD/24', '0:0:0:0:0:1234:BEEF:DEAD/24' ], +# include test for cisco syntax using space instead of '/' + [ 'dead:beef:1234:: 16', 'DEAD:BEEF:1234:0:0:0:0:0/16' ], + [ '::1234:BEEF:DEAD 24', '0:0:0:0:0:1234:BEEF:DEAD/24' ], + [ '::1234:BEEF:DEAD FFFF:FF00::', '0:0:0:0:0:1234:BEEF:DEAD/24' ], + ); +$| = 1; + +print '1..', (scalar @subnets) , "\n"; + +my $count = 1; + +for my $n (@subnets) { + my $ip = new NetAddr::IP::Lite $n->[0]; + if ($ip eq $n->[1]) { + print "ok $count\n"; + } + else { + print $ip, "\nnot ok $count\n"; + } + + ++ $count; +} diff --git a/MANIFEST b/MANIFEST index 6abfb05..ca1f7d1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -57,6 +57,7 @@ Lite/t/v4-range.t Lite/t/v4-snew.t Lite/t/v4-wnew.t +Lite/t/v6-cnew.t Lite/t/v6-contains.t Lite/t/v6-inc.t Lite/t/v6-new_cis6_base.t diff --git a/META.yml b/META.yml index 3c652e5..80a8560 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: NetAddr-IP -version: 4.037 +version: 4.038 abstract: Manages IPv4 and IPv6 addresses and subnets license: ~ author: