diff --git a/Changes b/Changes index 09d4330..e629cdb 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,11 @@ Revision history for Perl extension NetAddr::IP +4.064 Tue Sep 25 13:54:47 PDT 2012 + added support for rfc3021 /31 networks to hostenum + +4.063 Fri Aug 10 11:46:18 PDT 2012 + Updated GPL v2.0 text and address in all modules + 4.062 Wed Jun 6 12:34:48 PDT 2012 documentation updates courtesy of Ben Bullock diff --git a/Copying b/Copying index a43ea21..839998f 100644 --- a/Copying +++ b/Copying @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,8 +55,8 @@ The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE + + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -110,7 +110,7 @@ License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -255,7 +255,7 @@ of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -291,7 +291,7 @@ the "copyright" line and a pointer to where the full notice is found. - Copyright (C) 19yy + Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -303,23 +303,23 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type how w'. This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. + under certain conditions; type how c' for details. -The hypothetical commands `show w' and `show c' should show the appropriate +The hypothetical commands how w' and how c' should show the appropriate parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be +be called something other than how w' and how c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your @@ -327,7 +327,7 @@ necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. + nomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice @@ -335,5 +335,5 @@ This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/IP.pm b/IP.pm index 5c9f816..4347bff 100644 --- a/IP.pm +++ b/IP.pm @@ -4,8 +4,8 @@ use strict; #use diagnostics; -use NetAddr::IP::Lite 1.44 qw(Zero Zeros Ones V4mask V4net); -use NetAddr::IP::Util 1.46 qw( +use NetAddr::IP::Lite 1.45 qw(Zero Zeros Ones V4mask V4net); +use NetAddr::IP::Util 1.47 qw( sub128 inet_aton inet_any2n @@ -27,6 +27,7 @@ @ISA $VERSION $_netlimit + $rfc3021 ); require Exporter; @@ -35,7 +36,9 @@ @ISA = qw(Exporter NetAddr::IP::Lite); -$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.62 $ =~ /\d+/g) }; +$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.64 $ =~ /\d+/g) }; + +$rfc3021 = 0; =pod @@ -60,6 +63,7 @@ :upper :old_storable :old_nth + :rfc3021 ); NOTE: NetAddr::IP::Util has a full complement of network address @@ -393,6 +397,11 @@ NetAddr::IP::Util::upper(); @_ = grep { $_ ne ':upper' } @_; } + if (grep { $_ eq ':rfc3021' } @_) + { + $rfc3021 = 1; + @_ = grep { $_ ne ':rfc3021' } @_; + } NetAddr::IP->export_to_level(1, @_); } @@ -410,7 +419,8 @@ sub hostenumref($) { my $r = _splitref(0,$_[0]); - unless ((notcontiguous($_[0]->{mask}))[1] == 128) { + unless ((notcontiguous($_[0]->{mask}))[1] == 128 || + ($rfc3021 && $_[0]->masklen == 31) ) { splice(@$r, 0, 1); splice(@$r, scalar @$r - 1, 1); } @@ -1095,6 +1105,15 @@ Faster version of C<-Ehostenum()>, returning a reference to a list. +NOTE: hostenum and hostenumref report zero (0) useable hosts in a /31 +network. This is the behavior expected prior to RFC 3021. To report 2 +useable hosts for use in point-to-point networks, use B<:rfc3021> tag. + + use NetAddr::IP qw(:rfc3021); + +This will cause hostenum and hostenumref to return two (2) useable hosts in +a /31 network. + =item C<$me-Ecompact($addr1, $addr2, ...)> =item C<@compacted_object_list = Compact(@object_list)> @@ -1545,7 +1564,7 @@ =head1 COPYRIGHT This software is (c) Luis E. Muñoz, 1999 - 2007, and (c) Michael -Robinton, 2006 - 2011. +Robinton, 2006 - 2012. All rights reserved. @@ -1570,9 +1589,9 @@ You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write to the - Free Software Foundation, Inc. - 59 Temple Place, Suite 330 - Boston, MA 02111-1307, USA + Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301 USA. or visit their web page on the internet at: diff --git a/Lite/Changes b/Lite/Changes index 01ca42b..a77d60e 100644 --- a/Lite/Changes +++ b/Lite/Changes @@ -1,5 +1,7 @@ Revision history for Perl extension NetAddr::IP::Lite +1.45 Fri Aug 10 11:46:18 PDT 2012 + 1.44 Tue May 8 16:24:03 PDT 2012 fixed bug that return $ip->num() = 2^128 for 0.0.0.0/0 Thanks to Sebastian for spotting it. diff --git a/Lite/Lite.pm b/Lite/Lite.pm index b6d29b2..bef102e 100644 --- a/Lite/Lite.pm +++ b/Lite/Lite.pm @@ -32,7 +32,7 @@ use vars qw(@ISA @EXPORT_OK $VERSION $Accept_Binary_IP $Old_nth $AUTOLOAD *Zero); -$VERSION = do { my @r = (q$Revision: 1.44 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +$VERSION = do { my @r = (q$Revision: 1.45 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; require Exporter; @@ -1580,7 +1580,7 @@ =head1 COPYRIGHT This software is (c) Luis E. Mu�oz, 1999 - 2005 - and (c) Michael Robinton, 2006 - 2011. + and (c) Michael Robinton, 2006 - 2012. All rights reserved. @@ -1605,9 +1605,9 @@ You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write to the - Free Software Foundation, Inc. - 59 Temple Place, Suite 330 - Boston, MA 02111-1307, USA + Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301 USA or visit their web page on the internet at: diff --git a/Lite/README b/Lite/README index dd935a1..1677e4b 100644 --- a/Lite/README +++ b/Lite/README @@ -483,7 +483,7 @@ COPYRIGHT This software is (c) Luis E. Mu�oz, 1999 - 2005 - and (c) Michael Robinton, 2006 - 2011. + and (c) Michael Robinton, 2006 - 2012. All rights reserved. @@ -509,9 +509,9 @@ along with this program in the file named "Copying". If not, write to the - Free Software Foundation, Inc. - 59 Temple Place, Suite 330 - Boston, MA 02111-1307, USA + Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301 USA or visit their web page on the internet at: diff --git a/Lite/Util/Changes b/Lite/Util/Changes index b91d4ae..a0030b5 100644 --- a/Lite/Util/Changes +++ b/Lite/Util/Changes @@ -1,7 +1,9 @@ -1.47 +1.47 Fri Aug 10 11:46:18 PDT 2012 correct typo in documentation POD Thanks to Gregor Herrmann, Debian Perl Group + Updated GPL text and address + 1.46 Fri Nov 11 19:23:11 PST 2011 update documentation in InetBase v0.06 diff --git a/Lite/Util/README b/Lite/Util/README index 8c6f7df..2798b9b 100644 --- a/Lite/Util/README +++ b/Lite/Util/README @@ -563,7 +563,7 @@ Michael Robinton COPYRIGHT - Copyright 2003 - 2011, Michael Robinton + Copyright 2003 - 2012, Michael Robinton All rights reserved. @@ -590,8 +590,8 @@ the Free Software Foundation, Inc. - 59 Temple Place, Suite 330 - Boston, MA 02111-1307, USA + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301 USA. or visit their web page on the internet at: diff --git a/Lite/Util/Util.pm b/Lite/Util/Util.pm index c4e62bd..295c2c2 100644 --- a/Lite/Util/Util.pm +++ b/Lite/Util/Util.pm @@ -922,7 +922,7 @@ =head1 COPYRIGHT -Copyright 2003 - 2011, Michael Robinton Emichael@bizsystems.comE +Copyright 2003 - 2012, Michael Robinton Emichael@bizsystems.comE All rights reserved. @@ -947,9 +947,9 @@ You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write to the - Free Software Foundation, Inc. - 59 Temple Place, Suite 330 - Boston, MA 02111-1307, USA + Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301 USA. or visit their web page on the internet at: diff --git a/Lite/Util/Util.xs b/Lite/Util/Util.xs index 4a6b765..42de991 100644 --- a/Lite/Util/Util.xs +++ b/Lite/Util/Util.xs @@ -1,6 +1,6 @@ /* - * Copyright 2006 - 2010, Michael Robinton + * Copyright 2006 - 2012, Michael Robinton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,9 +12,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifdef __cplusplus diff --git a/Lite/Util/lib/NetAddr/IP/InetBase.pm b/Lite/Util/lib/NetAddr/IP/InetBase.pm index 58a07da..a8d2148 100644 --- a/Lite/Util/lib/NetAddr/IP/InetBase.pm +++ b/Lite/Util/lib/NetAddr/IP/InetBase.pm @@ -11,7 +11,7 @@ @ISA = qw(Exporter); -$VERSION = do { my @r = (q$Revision: 0.06 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +$VERSION = do { my @r = (q$Revision: 0.07 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; @EXPORT_OK = qw( inet_aton @@ -745,7 +745,7 @@ =head1 COPYRIGHT -Copyright 2003 - 2011, Michael Robinton Emichael@bizsystems.comE +Copyright 2003 - 2012, Michael Robinton Emichael@bizsystems.comE All rights reserved. @@ -770,9 +770,9 @@ You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write to the - Free Software Foundation, Inc. - 59 Temple Place, Suite 330 - Boston, MA 02111-1307, USA + Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301 USA or visit their web page on the internet at: diff --git a/Lite/Util/lib/NetAddr/IP/UtilPP.pm b/Lite/Util/lib/NetAddr/IP/UtilPP.pm index 9e7bc53..39330c5 100644 --- a/Lite/Util/lib/NetAddr/IP/UtilPP.pm +++ b/Lite/Util/lib/NetAddr/IP/UtilPP.pm @@ -12,7 +12,7 @@ @ISA = qw(Exporter); -$VERSION = do { my @r = (q$Revision: 1.8 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +$VERSION = do { my @r = (q$Revision: 1.9 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; @EXPORT_OK = qw( hasbits @@ -680,7 +680,7 @@ =head1 COPYRIGHT -Copyright 2003 - 2011, Michael Robinton Emichael@bizsystems.comE +Copyright 2003 - 2012, Michael Robinton Emichael@bizsystems.comE All rights reserved. @@ -705,9 +705,9 @@ You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write to the - Free Software Foundation, Inc. - 59 Temple Place, Suite 330 - Boston, MA 02111-1307, USA + Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor + Boston, MA 02110-1301 USA or visit their web page on the internet at: diff --git a/MANIFEST b/MANIFEST index a069904..d464c42 100644 --- a/MANIFEST +++ b/MANIFEST @@ -20,6 +20,7 @@ t/over-arr.t t/over-qq.t t/relops.t +t/rfc3021.t t/short.t t/splitref.t t/v4-coalesce.t diff --git a/META.yml b/META.yml index fb439ce..792b667 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: NetAddr-IP -version: 4.062 +version: 4.064 abstract: Manages IPv4 and IPv6 addresses and subnets license: ~ author: diff --git a/t/rfc3021.t b/t/rfc3021.t new file mode 100644 index 0000000..b955d47 --- /dev/null +++ b/t/rfc3021.t @@ -0,0 +1,31 @@ +use NetAddr::IP; + +$| = 1; + +print '1..4', "\n"; + +my $test = 1; + +my $ip = new NetAddr::IP('192.168.1.8/31'); +my @hosts = $ip->hostenum; + +print scalar(@hosts)," found where none expected\nnot " + if @hosts; +print "ok ",$test++,"\n"; + +NetAddr::IP::import qw(:rfc3021); + +@hosts = $ip->hostenum; + +print scalar(@hosts)," found where 2 expected\nnot " + unless @hosts == 2; +print "ok ",$test++,"\n"; + +print "got: $hosts[0], exp: 192.168.1.8/32\nnot " + unless "$hosts[0]" eq '192.168.1.8/32'; +print "ok ",$test++,"\n"; + +print "got: $hosts[1], exp: 192.168.1.9/32\nnot " + unless "$hosts[1]" eq '192.168.1.9/32'; +print "ok ",$test++,"\n"; +