Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

converted from Net::AddrIPv4 to the excellent NetAddr::IP module

  • Loading branch information...
commit 7a7e4653c3dcd56884fc88e78bedcbda691f6647 1 parent cca8f70
@mrash authored
Showing with 26,626 additions and 971 deletions.
  1. +0 −90 deps/Net-IPv4Addr/ChangeLog
  2. +0 −385 deps/Net-IPv4Addr/IPv4Addr.pm
  3. +0 −90 deps/Net-IPv4Addr/IPv4Addr.spec
  4. +0 −15 deps/Net-IPv4Addr/MANIFEST
  5. +0 −8 deps/Net-IPv4Addr/Makefile.PL
  6. +0 −28 deps/Net-IPv4Addr/NEWS
  7. +0 −41 deps/Net-IPv4Addr/README
  8. +0 −1  deps/Net-IPv4Addr/VERSION
  9. +0 −37 deps/Net-IPv4Addr/debian/changelog
  10. +0 −12 deps/Net-IPv4Addr/debian/control
  11. +0 −14 deps/Net-IPv4Addr/debian/copyright
  12. +0 −4 deps/Net-IPv4Addr/debian/dirs
  13. +0 −4 deps/Net-IPv4Addr/debian/docs
  14. +0 −85 deps/Net-IPv4Addr/debian/rules
  15. +0 −89 deps/Net-IPv4Addr/ipv4calc
  16. +0 −68 deps/Net-IPv4Addr/test.pl
  17. +131 −0 deps/NetAddr-IP/Artistic
  18. +464 −0 deps/NetAddr-IP/Changes
  19. +339 −0 deps/NetAddr-IP/Copying
  20. +1,572 −0 deps/NetAddr-IP/IP.pm
  21. +373 −0 deps/NetAddr-IP/Lite/Changes
  22. +1,583 −0 deps/NetAddr-IP/Lite/Lite.pm
  23. +126 −0 deps/NetAddr-IP/Lite/MANIFEST
  24. +31 −0 deps/NetAddr-IP/Lite/MANIFEST.SKIP
  25. +10 −0 deps/NetAddr-IP/Lite/META.yml
  26. +42 −0 deps/NetAddr-IP/Lite/Makefile.PL
  27. +510 −0 deps/NetAddr-IP/Lite/README
  28. +255 −0 deps/NetAddr-IP/Lite/Util/Changes
  29. +53 −0 deps/NetAddr-IP/Lite/Util/MANIFEST
  30. +31 −0 deps/NetAddr-IP/Lite/Util/MANIFEST.SKIP
  31. +235 −0 deps/NetAddr-IP/Lite/Util/Makefile.PL
  32. +605 −0 deps/NetAddr-IP/Lite/Util/README
  33. +968 −0 deps/NetAddr-IP/Lite/Util/Util.pm
  34. +801 −0 deps/NetAddr-IP/Lite/Util/Util.xs
  35. +127 −0 deps/NetAddr-IP/Lite/Util/config.h.in
  36. +7,799 −0 deps/NetAddr-IP/Lite/Util/configure
  37. +54 −0 deps/NetAddr-IP/Lite/Util/configure.ac
  38. +791 −0 deps/NetAddr-IP/Lite/Util/lib/NetAddr/IP/InetBase.pm
  39. +722 −0 deps/NetAddr-IP/Lite/Util/lib/NetAddr/IP/UtilPP.pm
  40. +80 −0 deps/NetAddr-IP/Lite/Util/localconf.h
  41. +69 −0 deps/NetAddr-IP/Lite/Util/t/4to6.t
  42. +92 −0 deps/NetAddr-IP/Lite/Util/t/add128.t
  43. +77 −0 deps/NetAddr-IP/Lite/Util/t/addconst.t
  44. +46 −0 deps/NetAddr-IP/Lite/Util/t/af_inet6.t
  45. +86 −0 deps/NetAddr-IP/Lite/Util/t/anyto6.t
  46. +69 −0 deps/NetAddr-IP/Lite/Util/t/badd.t
  47. +68 −0 deps/NetAddr-IP/Lite/Util/t/bcd2bin.t
  48. +73 −0 deps/NetAddr-IP/Lite/Util/t/bcdn2bin.t
  49. +111 −0 deps/NetAddr-IP/Lite/Util/t/bin.t
  50. +49 −0 deps/NetAddr-IP/Lite/Util/t/binet_n2ad.t
  51. +50 −0 deps/NetAddr-IP/Lite/Util/t/binet_n2dx.t
  52. +66 −0 deps/NetAddr-IP/Lite/Util/t/binet_ntoa.t
  53. +96 −0 deps/NetAddr-IP/Lite/Util/t/binet_pton.t
  54. +59 −0 deps/NetAddr-IP/Lite/Util/t/bipv4_inet.t
  55. +48 −0 deps/NetAddr-IP/Lite/Util/t/bipv6_any2n.t
  56. +76 −0 deps/NetAddr-IP/Lite/Util/t/bipv6func.t
  57. +187 −0 deps/NetAddr-IP/Lite/Util/t/bisIPv4.t
  58. +52 −0 deps/NetAddr-IP/Lite/Util/t/bpackzeros.t
  59. +48 −0 deps/NetAddr-IP/Lite/Util/t/comp128.t
  60. +168 −0 deps/NetAddr-IP/Lite/Util/t/croak.t
  61. +147 −0 deps/NetAddr-IP/Lite/Util/t/hasbits.t
  62. +70 −0 deps/NetAddr-IP/Lite/Util/t/inet_4map6.t
  63. +48 −0 deps/NetAddr-IP/Lite/Util/t/inet_n2ad.t
  64. +50 −0 deps/NetAddr-IP/Lite/Util/t/inet_n2dx.t
  65. +96 −0 deps/NetAddr-IP/Lite/Util/t/inet_pton.t
  66. +59 −0 deps/NetAddr-IP/Lite/Util/t/ipv4_inet.t
  67. +47 −0 deps/NetAddr-IP/Lite/Util/t/ipv6_any2n.t
  68. +66 −0 deps/NetAddr-IP/Lite/Util/t/ipv6_ntoa.t
  69. +75 −0 deps/NetAddr-IP/Lite/Util/t/ipv6func.t
  70. +55 −0 deps/NetAddr-IP/Lite/Util/t/ipv6to4.t
  71. +186 −0 deps/NetAddr-IP/Lite/Util/t/isIPv4.t
  72. +58 −0 deps/NetAddr-IP/Lite/Util/t/leftshift.t
  73. +26 −0 deps/NetAddr-IP/Lite/Util/t/mode.t
  74. +59 −0 deps/NetAddr-IP/Lite/Util/t/naip_gethostbyname.t
  75. +58 −0 deps/NetAddr-IP/Lite/Util/t/no6_naip_gethostbyname.t
  76. +72 −0 deps/NetAddr-IP/Lite/Util/t/notcontiguous.t
  77. +53 −0 deps/NetAddr-IP/Lite/Util/t/packzeros.t
  78. +51 −0 deps/NetAddr-IP/Lite/Util/t/simple_pack.t
  79. +68 −0 deps/NetAddr-IP/Lite/Util/t/sub128.t
  80. +51 −0 deps/NetAddr-IP/Lite/Util/tlib/NetAddr/IP/Util_IS.pm
  81. +28 −0 deps/NetAddr-IP/Lite/Util/typemap
  82. +96 −0 deps/NetAddr-IP/Lite/bug2742981
  83. +36 −0 deps/NetAddr-IP/Lite/t/addr.t
  84. +33 −0 deps/NetAddr-IP/Lite/t/aton.t
  85. +170 −0 deps/NetAddr-IP/Lite/t/bigint.t
  86. +130 −0 deps/NetAddr-IP/Lite/t/bignums.t
  87. +102 −0 deps/NetAddr-IP/Lite/t/bin_ips.t
  88. +37 −0 deps/NetAddr-IP/Lite/t/bits.t
  89. +37 −0 deps/NetAddr-IP/Lite/t/broadcast.t
  90. +28 −0 deps/NetAddr-IP/Lite/t/bug62521.t
  91. +36 −0 deps/NetAddr-IP/Lite/t/cidr.t
  92. +19 −0 deps/NetAddr-IP/Lite/t/constants.t
  93. +40 −0 deps/NetAddr-IP/Lite/t/contains.t
  94. +52 −0 deps/NetAddr-IP/Lite/t/copy.t
  95. +66 −0 deps/NetAddr-IP/Lite/t/firstlast.t
  96. +19 −0 deps/NetAddr-IP/Lite/t/lemasklen.t
  97. +51 −0 deps/NetAddr-IP/Lite/t/loops.t
  98. +11 −0 deps/NetAddr-IP/Lite/t/lower.t
  99. +44 −0 deps/NetAddr-IP/Lite/t/mask.t
  100. +37 −0 deps/NetAddr-IP/Lite/t/masklen.t
  101. +208 −0 deps/NetAddr-IP/Lite/t/netaddr.t
  102. +44 −0 deps/NetAddr-IP/Lite/t/network.t
  103. +44 −0 deps/NetAddr-IP/Lite/t/new-nth.t
  104. +33 −0 deps/NetAddr-IP/Lite/t/new-num.t
  105. +36 −0 deps/NetAddr-IP/Lite/t/numeric.t
  106. +36 −0 deps/NetAddr-IP/Lite/t/old-nth.t
  107. +33 −0 deps/NetAddr-IP/Lite/t/old-num.t
  108. +53 −0 deps/NetAddr-IP/Lite/t/over-qq.t
  109. +66 −0 deps/NetAddr-IP/Lite/t/over_comp.t
  110. +85 −0 deps/NetAddr-IP/Lite/t/over_copy.t
  111. +122 −0 deps/NetAddr-IP/Lite/t/over_equal.t
  112. +64 −0 deps/NetAddr-IP/Lite/t/over_math.t
  113. +45 −0 deps/NetAddr-IP/Lite/t/overminus.t
  114. +27 −0 deps/NetAddr-IP/Lite/t/pathological.t
  115. +34 −0 deps/NetAddr-IP/Lite/t/range.t
  116. +59 −0 deps/NetAddr-IP/Lite/t/relops.t
  117. +59 −0 deps/NetAddr-IP/Lite/t/v4-aton.t
  118. +42 −0 deps/NetAddr-IP/Lite/t/v4-badnm.t
  119. +19 −0 deps/NetAddr-IP/Lite/t/v4-base.t
  120. +24 −0 deps/NetAddr-IP/Lite/t/v4-basem.t
  121. +28 −0 deps/NetAddr-IP/Lite/t/v4-cidr.t
  122. +30 −0 deps/NetAddr-IP/Lite/t/v4-cnew.t
  123. +60 −0 deps/NetAddr-IP/Lite/t/v4-contains.t
  124. +32 −0 deps/NetAddr-IP/Lite/t/v4-last.t
  125. +30 −0 deps/NetAddr-IP/Lite/t/v4-new-first.t
  126. +67 −0 deps/NetAddr-IP/Lite/t/v4-new.t
  127. +27 −0 deps/NetAddr-IP/Lite/t/v4-new_from_aton.t
  128. +50 −0 deps/NetAddr-IP/Lite/t/v4-no_octal.t
  129. +36 −0 deps/NetAddr-IP/Lite/t/v4-num.t
  130. +36 −0 deps/NetAddr-IP/Lite/t/v4-numeric.t
  131. +30 −0 deps/NetAddr-IP/Lite/t/v4-old-first.t
  132. +48 −0 deps/NetAddr-IP/Lite/t/v4-range.t
  133. +29 −0 deps/NetAddr-IP/Lite/t/v4-snew.t
  134. +23 −0 deps/NetAddr-IP/Lite/t/v4-wnew.t
  135. +68 −0 deps/NetAddr-IP/Lite/t/v4_new_cis.t
  136. +27 −0 deps/NetAddr-IP/Lite/t/v6-cnew.t
  137. +51 −0 deps/NetAddr-IP/Lite/t/v6-contains.t
  138. +38 −0 deps/NetAddr-IP/Lite/t/v6-inc.t
  139. +70 −0 deps/NetAddr-IP/Lite/t/v6-new-base.t
  140. +69 −0 deps/NetAddr-IP/Lite/t/v6-new_cis6_base.t
  141. +69 −0 deps/NetAddr-IP/Lite/t/v6-new_cis_base.t
  142. +53 −0 deps/NetAddr-IP/Lite/t/v6-num.t
  143. +91 −0 deps/NetAddr-IP/Lite/t/v6-numeric.t
  144. +70 −0 deps/NetAddr-IP/Lite/t/v6-old-base.t
  145. +29 −0 deps/NetAddr-IP/Lite/t/version.t
  146. +40 −0 deps/NetAddr-IP/Lite/t/within.t
  147. +165 −0 deps/NetAddr-IP/MANIFEST
  148. +31 −0 deps/NetAddr-IP/MANIFEST.SKIP
  149. +14 −0 deps/NetAddr-IP/META.yml
  150. +91 −0 deps/NetAddr-IP/Makefile.PL
  151. +5 −0 deps/NetAddr-IP/TODO
  152. +1 −0  deps/NetAddr-IP/VERSION
  153. +1,023 −0 deps/NetAddr-IP/docs/rfc1884.txt
  154. +20 −0 deps/NetAddr-IP/t/constants.t
  155. +25 −0 deps/NetAddr-IP/t/full.t
  156. +25 −0 deps/NetAddr-IP/t/full6.t
  157. +35 −0 deps/NetAddr-IP/t/imhoff.t
  158. +33 −0 deps/NetAddr-IP/t/loops.t
  159. +11 −0 deps/NetAddr-IP/t/lower.t
  160. +21 −0 deps/NetAddr-IP/t/masklen.t
  161. +40 −0 deps/NetAddr-IP/t/new-store.t
  162. +40 −0 deps/NetAddr-IP/t/old-store.t
  163. +20 −0 deps/NetAddr-IP/t/over-arr.t
  164. +55 −0 deps/NetAddr-IP/t/over-qq.t
  165. +59 −0 deps/NetAddr-IP/t/relops.t
  166. +57 −0 deps/NetAddr-IP/t/short.t
  167. +27 −0 deps/NetAddr-IP/t/splitref.t
  168. +54 −0 deps/NetAddr-IP/t/v4-coalesce.t
  169. +110 −0 deps/NetAddr-IP/t/v4-compact.t
  170. +35 −0 deps/NetAddr-IP/t/v4-compplus.t
  171. +50 −0 deps/NetAddr-IP/t/v4-hostenum.t
  172. +38 −0 deps/NetAddr-IP/t/v4-re.t
  173. +23 −0 deps/NetAddr-IP/t/v4-split-bulk.t
  174. +54 −0 deps/NetAddr-IP/t/v4-split-list.t
  175. +73 −0 deps/NetAddr-IP/t/v4-splitplan.t
  176. +51 −0 deps/NetAddr-IP/t/v4-sprefix.t
  177. +48 −0 deps/NetAddr-IP/t/v4-xprefix.t
  178. +69 −0 deps/NetAddr-IP/t/v6-re.t
  179. +21 −0 deps/NetAddr-IP/t/v6-split-bulk.t
  180. +72 −0 deps/NetAddr-IP/t/v6-splitplan.t
  181. +37 −0 deps/NetAddr-IP/t/wildcard.t
View
90 deps/Net-IPv4Addr/ChangeLog
@@ -1,90 +0,0 @@
-2000-08-01 Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
- * Tag: IPV4ADDR_0_10
-
- * IPv4Addr.spec: Updated for version 0.10.
- Updated spec file to use new macros.
-
- * IPv4Addr.pm (ipv4_network): Bad network for 0.0.0.0/0.
- (ipv4_broadcast): Bad broadcast for 0.0.0.0/0.
- (ipv4_in_network): 0.0.0.0/0 was included in any nets.
- (VERSION): Updated version number to 0.10.
-
- * NEWS: News for 0.10.
-
- * README: Updated version number to 0.10.
-
- * test.pl: Added test for ipv4_in_network( anything, 0.0.0.0/0).
-
- * debian/rules: Merged changes from Bernd
-.
- * debian/changelog: Merged changes from Bernd.
-
- * debian/control: Merged changes from Bernd.
-
- * IPv4Addr.pm: Copyright mods.
-
-2000-07-27 Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
- * IPv4Addr (%EXPORT_TAGS): ipv4_chkip was exported
- under the wrong name.
-
-2000-05-03 Francis J. Lacoste <francis.lacoste@iNsu.COM>
- * Tag: IPV4ADDR_0_09
-
- * test.pl: Added test for different class networks.
-
- * IPv4Addr.pm (ipv4_in_network) Fixed bug where
- comparison between network that differ
- by more than an octet failed.
- (version) Incremented version number
- to 0.09.
-
-1999-12-15 Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
- * Tag: IPV4ADDR_0_08
-
- * IPv4Addr.pm: Moved require statement inside BEGIN to
- fix problems with ipv4calc.
-
- Incremented version number to 0.08.
-
-1999-10-19 Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
- TAG: IPV4ADDR_0_07
-
- * debian/: Added debian packaging by Bernd Eckenfels
- <ecki@lina.inka.de>
-
- TAG: IPV4ADDR_0_06
-
- * IPv4Addr.pm: Renamed module to Net::IPv4Addr.
-
-1999-09-15 Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
- * IPv4Addr.pm: Corrected errors in the documentation.
-
- TAG: IPV4ADDR_0_05.
-
-1999-08-15 Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
- * IPv4Addr.pm (ipv4_in_netwrok): Fixed broken logic
- of ipv4_in_network. It didn't handle
- correctly network which weren't of
- the same size.
-
- TAG: IPV4ADDR_0_04.
-
-1999-07-05 Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
- * IPv4Addr.pm (ipv4_in_network): Added check for universal
- broadcast address (255.255.255.255) and
- no address (0.0.0.0).
-
- TAG: IPV4ADDR_0_03.
-
-1999-05-27 Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
- * IPv4Addr.pm: (ipv4_parse) removed some undefined warnings.
- Updated version to 0.02.
-
View
385 deps/Net-IPv4Addr/IPv4Addr.pm
@@ -1,385 +0,0 @@
-# IPv4Addr.pm - Perl module to manipulate IPv4 addresses.
-#
-# Author: Francis J. Lacoste <francis.lacoste@iNsu.COM>
-#
-# Copyright (C) 1999, 2000 iNsu Innovations Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms as perl itself.
-#
-
-package Net::IPv4Addr;
-
-use strict;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-
-BEGIN {
- require Exporter;
- require AutoLoader;
-
- @ISA = qw(Exporter AutoLoader);
-
- @EXPORT = qw();
-
- %EXPORT_TAGS = (
- all => [qw{ ipv4_parse ipv4_chkip
- ipv4_network ipv4_broadcast
- ipv4_cidr2msk ipv4_msk2cidr
- ipv4_in_network ipv4_dflt_netmask
- } ],
- );
-
- @EXPORT_OK = qw();
-
- Exporter::export_ok_tags('all');
-
- $VERSION = '0.10';
-}
-
-# Preloaded methods go here.
-use Carp;
-
-# Functions to manipulate IPV4 address
-my $ip_rgx = "\\d+\\.\\d+\\.\\d+\\.\\d+";
-
-# Given an IPv4 address in host, ip/netmask or cidr format
-# returns a ip / cidr pair.
-sub ipv4_parse($;$) {
- my ($ip,$msk);
- # Called with 2 args, assume first is IP address
- if ( defined $_[1] ) {
- $ip = $_[0];
- $msk= $_[1];
- } else {
- ($ip) = $_[0] =~ /($ip_rgx)/o;
- ($msk) = $_[0] =~ m!/(.+)!o;
- }
-
- # Remove white spaces
- $ip = ipv4_chkip( $ip ) or
- croak __PACKAGE__, ": invalid IPv4 address: ", $ip, "\n";
- $msk =~ s/\s//g if defined $msk;
-
- # Check Netmask to see if it is a CIDR or Network
- if (defined $msk ) {
- if ($msk =~ /^\d{1,2}$/) {
- # Check cidr
- croak __PACKAGE__, ": invalid cidr: ", $msk, "\n"
- if $msk < 0 or $msk > 32;
- } elsif ($msk =~ /^$ip_rgx$/o ) {
- $msk = ipv4_msk2cidr($msk);
- } else {
- croak __PACKAGE__, ": invalid netmask specification: ", $msk, "\n";
- }
- } else {
- # Host
- return $ip;
- }
- wantarray ? ($ip,$msk) : "$ip/$msk";
-}
-
-sub ipv4_dflt_netmask($) {
- my ($ip) = ipv4_parse($_[0]);
-
- my ($b1) = split /\./, $ip;
-
- return "255.0.0.0" if $b1 <= 127;
- return "255.255.0.0" if $b1 <= 191;
- return "255.255.255.0";
-}
-
-# Check form a valid IPv4 address.
-sub ipv4_chkip($) {
- my ($ip) = $_[0] =~ /($ip_rgx)/o;
-
- return undef unless $ip;
-
- # Check that bytes are in range
- for (split /\./, $ip ) {
- return undef if $_ < 0 or $_ > 255;
- }
- return $ip;
-}
-
-# Transform a netmask in a CIDR mask length
-sub ipv4_msk2cidr($) {
- my $msk = ipv4_chkip( $_[0] )
- or croak __PACKAGE__, ": invalid netmask: ", $_[0], "\n";
-
- my @bytes = split /\./, $msk;
-
- my $cidr = 0;
- for (@bytes) {
- my $bits = unpack( "B*", pack( "C", $_ ) );
- $cidr += $bits =~ tr /1/1/;
- }
- return $cidr;
-}
-
-# Transform a CIDR mask length in a netmask
-sub ipv4_cidr2msk($) {
- my $cidr = shift;
- croak __PACKAGE__, ": invalid cidr: ", $cidr, "\n"
- if $cidr < 0 or $cidr > 32;
-
- my $bits = "1" x $cidr . "0" x (32 - $cidr);
-
- return join ".", (unpack 'CCCC', pack("B*", $bits ));
-}
-
-# Return the network address of
-# an IPv4 address
-sub ipv4_network($;$) {
- my ($ip,$cidr) = ipv4_parse( $_[0], $_[1] );
-
- # If only an host is given, use the default netmask
- unless (defined $cidr) {
- $cidr = ipv4_msk2cidr( ipv4_dflt_netmask($ip) );
- }
- my $u32 = unpack "N", pack "CCCC", split /\./, $ip;
- my $bits = "1" x $cidr . "0" x (32 - $cidr );
-
- my $msk = unpack "N", pack "B*", $bits;
-
- my $net = join ".", unpack "CCCC", pack "N", $u32 & $msk;
-
- wantarray ? ( $net, $cidr) : "$net/$cidr";
-}
-
-sub ipv4_broadcast($;$) {
- my ($ip,$cidr) = ipv4_parse( $_[0], $_[1] );
-
- # If only an host is given, use the default netmask
- unless (defined $cidr) {
- $cidr = ipv4_msk2cidr( ipv4_dflt_netmask($ip) );
- }
-
- my $u32 = unpack "N", pack "CCCC", split /\./, $ip;
- my $bits = "1" x $cidr . "0" x (32 - $cidr );
-
- my $msk = unpack "N", pack "B*", $bits;
-
- my $broadcast = join ".", unpack "CCCC", pack "N", $u32 | ~$msk;
-
- $broadcast;
-}
-
-sub ipv4_in_network($$;$$) {
- my ($ip1,$cidr1,$ip2,$cidr2);
- if ( @_ >= 3) {
- ($ip1,$cidr1) = ipv4_parse( $_[0], $_[1] );
- ($ip2,$cidr2) = ipv4_parse( $_[2], $_[3] );
- } else {
- ($ip1,$cidr1) = ipv4_parse( $_[0]);
- ($ip2,$cidr2) = ipv4_parse( $_[1]);
- }
-
- # Check for magic addresses.
- return 1 if ($ip1 eq "255.255.255.255" or $ip1 eq "0.0.0.0")
- and !defined $cidr1;
- return 1 if ($ip2 eq "255.255.255.255" or $ip2 eq "0.0.0.0")
- and !defined $cidr2;
-
- # Case where first argument is really an host
- return $ip1 eq $ip2 unless (defined $cidr1);
-
- # Case where second argument is an host
- if ( not defined $cidr2) {
- return ipv4_network( $ip1, $cidr1) eq ipv4_network( $ip2, $cidr1 );
- } elsif ( $cidr2 >= $cidr1 ) {
- # Network 2 is smaller or equal than network 1
- return ipv4_network( $ip1, $cidr1 ) eq ipv4_network( $ip2, $cidr1 );
- } else {
- # Network 2 is bigger, so can't be wholly contained.
- return 0;
- }
-}
-# Autoload methods go after =cut, and are processed by the autosplit program.
-
-1;
-__END__
-# Below is the stub of documentation for your module. You better edit it!
-=pod
-
-=head1 NAME
-
-Net::IPv4Addr - Perl extension for manipulating IPv4 addresses.
-
-=head1 SYNOPSIS
-
- use Net::IPv4Addr qw( :all );
-
- my ($ip,$cidr) = ipv4_parse( "127.0.0.1/24" );
- my ($ip,$cidr) = ipv4_parse( "192.168.100.10 / 255.255.255.0" );
-
- my ($net,$msk) = ipv4_network( "192.168.100.30" );
-
- my $broadcast = ipv4_broadcast( "192.168.100.30/26" );
-
- if ( ipv4_in_network( "192.168.100.0", $her_ip ) ) {
- print "Welcome !";
- }
-
- etc.
-
-=head1 DESCRIPTION
-
-Net::IPv4Addr provides functions for parsing IPv4 addresses both
-in traditional address/netmask format and in the new CIDR format.
-There are also methods for calculating the network and broadcast
-address and also to see check if a given address is in a specific
-network.
-
-=head1 ADDRESSES
-
-All of Net::IPv4Addr functions accepts addresses in many
-format. The parsing is very liberal.
-
-All these addresses would be accepted:
-
- 127.0.0.1
- 192.168.001.010/24
- 192.168.10.10/255.255.255.0
- 192.168.30.10 / 21
- 10.0.0.0 / 255.0.0.0
- 255.255.0.0
-
-Those wouldn't though:
-
- 272.135.234.0
- 192.168/16
-
-Most functions accepts the address and netmask or masklength in the
-same scalar value or as separate values. That is either
-
- my($ip,$masklength) = ipv4_parse($cidr_str);
- my($ip,$masklength) = ipv4_parse($ip_str,$msk_str);
-
-=head1 USING
-
-No functions are exported by default. Either use the C<:all> tag
-to import them all or explicitly import those you need.
-
-=head1 FUNCTIONS
-
-=over
-
-=item ipv4_parse
-
- my ($ip,$msklen) = ipv4_parse($cidr_str);
- my $cidr = ipv4_parse($ip_str,$msk_str);
- my ($ip) = ipv4_parse($ip_str,$msk_str);
-
-Parse an IPv4 address and in scalar context the address in CIDR
-format and in an array context the address and the mask length.
-
-If the parameters doesn't contains a netmask or a mask length,
-in scalar context only the IPv4 address is returned and in an
-array context the mask length is undefined.
-
-If the function cannot parse its input, it croaks. Trap it using
-C<eval> if don't like that.
-
-=item ipv4_network
-
- my $cidr = ipv4_network($ip_str);
- my $cidr = ipv4_network($cidr_str);
- my ($net,$msk) = ipv4_network( $net_str, $msk_str);
-
-In scalar context, this function returns the network in CIDR format in
-which the address is. In array context, it returns the network address and
-its mask length as a two elements array. If the input is an host without
-a netmask of mask length, the default netmask is assumed.
-
-Again, the function croak if the input is invalid.
-
-=item ipv4_broadcast
-
- my ($broadcast) = ipv4_broadcast($ip_str);
- my $broadcast = ipv4_broadcast($ip_str,$msk_str);
-
-This function returns the broadcast address. If the input doesn't
-contains a netmask or mask length, the default netmask is assumed.
-
-This function croaks if the input is invalid.
-
-=item ipv4_network
-
- my $cidr = ipv4_network($net_str);
- my $cidr = ipv4_network($cidr_sstr);
- my ($net,$msk) = ipv4_network( $ip_str, $mask_str);
-
-In scalar context, this function returns the network in CIDR format in
-which the address is. In array context, it returns the network address and
-its mask length as a two elements array. If the input is an host without
-a netmask or mask length, the default netmask is assumed.
-
-Again, the function croak if the input is invalid.
-
-=item ipv4_in_network
-
- print "Yes" if ipv4_in_network( $cidr_str1, $cidr_str2);
- print "Yes" if ipv4_in_network( $ip_str1, $mask_str1, $cidr_str2 );
- print "Yes" if ipv4_in_network( $ip1, $mask1, $ip2, $msk2 );
-
-This function checks if the second network is contained in
-the first one and it implements the following semantics :
-
- If net1 or net2 is a magic address (0.0.0.0 or 255.255.255.255)
- than this function returns true.
-
- If net1 is an host, net2 will be in the same net only if
- it is the same host.
-
- If net2 is an host, it will be contained in net1 only if
- it is part of net1.
-
- If net2 is only part of net1 if it is entirely contained in
- net1.
-
-Trap bad input with C<eval> or else.
-
-=item ipv4_checkip
-
- if ($ip = ipv4_checkip($str) ) {
- # Do something
- }
-
-Return the IPv4 address in the string or undef if the input
-doesn't contains a valid IPv4 address.
-
-=item ipv4_cidr2msk
-
- my $netmask = ipv4_cidr2msk( $cidr );
-
-Returns the netmask corresponding to the mask length given in input.
-As usual, croaks if it doesn't like your input (in this case a number
-between 0 and 32).
-
-=item ipv4_msk2cidr
-
- my $masklen = ipv4_msk2cidr( $msk );
-
-Returns the mask length of the netmask in input. As usual, croaks if it
-doesn't like your input.
-
-=back
-
-=head1 AUTHOR
-
-Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
-=head1 COPYRIGHT
-
-Copyright (c) 1999, 2000 iNsu Innovations Inc.
-All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
-
-=head1 SEE ALSO
-
-perl(1) ipv4calc(1).
-
-=cut
-
View
90 deps/Net-IPv4Addr/IPv4Addr.spec
@@ -1,90 +0,0 @@
-Summary: Perl modules to manipulates Ipv4 addresses.
-Name: Net-IPv4Addr
-Version: 0.10
-Release: 1i
-Source: http://iNDev.iNsu.COM/sources/%{name}-%{version}.tar.gz
-Copyright: GPL or Artistic License
-Group: Development/Libraries
-Prefix: /usr
-URL: http://iNDev.iNsu.COM/IPv4Addr/
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-BuildArchitectures: noarch
-Obsoletes: Network-IPv4Addr
-
-%description
-Net::IPv4Addr provides methods for parsing IPv4
-addresses both in traditional address/netmask format and
-in the new CIDR format. There are also methods for
-calculating the network and broadcast address and also to
-see check if a given address is in a specific network.
-
-%prep
-%setup -q
-%fix_perl_path
-
-%build
-perl Makefile.PL
-make OPTIMIZE="$RPM_OPT_FLAGS"
-make test
-
-%install
-rm -fr $RPM_BUILD_ROOT
-%perl_make_install
-
-BuildDirList > %pkg_file_list
-BuildFileList >> %pkg_file_list
-
-%clean
-rm -fr $RPM_BUILD_ROOT
-
-%files -f %{name}-file-list
-%defattr(-,root,root)
-%doc README ChangeLog
-
-%changelog
-* Tue Aug 01 2000 Francis J. Lacoste <francis.lacoste@iNsu.COM>
- [0.10-1i]
-- Updated to version 0.10.
-- Updated spec file to use new macros.
-
-* Wed May 03 2000 Francis J. Lacoste <francis.lacoste@iNsu.COM>
- [0.09-1i]
-- Updated to version 0.09.
-- Updated automatic file list generation.
-- Changed group.
-
-* Wed Dec 15 1999 Francis J. Lacoste <francis.lacoste@iNsu.COM>
- [0.08-1i]
-- Updated to version 0.08.
-- Added perl(Net::IPv4Addr) to list of Provides.
-- Fixed Source URL.
-
-* Tue Oct 19 1999 Francis J. Lacoste <francis.lacoste@iNsu.COM>
- [0.07-1i]
-- Updated to version 0.07
-
-* Tue Oct 19 1999 Francis J. Lacoste <francis.lacoste@iNsu.COM>
- [0.06-1i]
-- Updated to version 0.06.
-- Renamed package to Net-IPv4Addr.
-
-* Wed Sep 15 1999 Francis J. Lacoste <francis.lacoste@iNsu.COM>
- [0.05-1i]
-- Updated to version 0.05.
-
-* Sun Aug 15 1999 Francis J. Lacoste <francis.lacoste@iNsu.COM>
- [0.04-1i]
-- Updated to version 0.04.
-
-* Mon Jul 05 1999 Francis J. Lacoste <francis.lacoste@iNsu.COM>
- [0.03-1i]
-- Updated to version 0.03.
-
-* Sat May 15 1999 Francis J. Lacoste <francis@iNsu.COM>
- [0.02-2i]
-- Updated to version 0.02.
-
-* Sat May 15 1999 Francis J. Lacoste <francis@iNsu.COM>
- [0.01-1i]
-- First RPM release.
-
View
15 deps/Net-IPv4Addr/MANIFEST
@@ -1,15 +0,0 @@
-NEWS
-README
-ChangeLog
-IPv4Addr.pm
-MANIFEST
-Makefile.PL
-test.pl
-IPv4Addr.spec
-ipv4calc
-debian/changelog
-debian/control
-debian/copyright
-debian/dirs
-debian/docs
-debian/rules
View
8 deps/Net-IPv4Addr/Makefile.PL
@@ -1,8 +0,0 @@
-use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
-WriteMakefile(
- 'NAME' => 'Net::IPv4Addr',
- 'VERSION_FROM' => 'IPv4Addr.pm', # finds $VERSION
- 'EXE_FILES' => [ ipv4calc ],
-);
View
28 deps/Net-IPv4Addr/NEWS
@@ -1,28 +0,0 @@
-Net::IPv4Addr NEWS -- History of User-Visible Changes. May 03 2000
-
-* Changes in IPv4Addr 0.10
-
- - Fixed important errors which occurs when using
- a /0 CIDR. Thanks to Bernd Eckenfels from Debian
- for the fix.
-
- - Fixed : ipv4_in_network( anything, 0.0.0.0/0) was
- returning true. Thanks to Bernd Eckenfels from Debian
- for the fix.
-
- - ipv4_chkip wasn't exported with the all tag.
-
-* Changes in IPv4Addr 0.09
-
- - Fixed an important bug in ipv4_in_network which caused
- comparison between networks that where in different class
- to fail.
-
-* Changes in IPv4Addr 0.07
-
- - Debian packaging done by Bernd Eckenfels <ecki@lina.inka.de>.
-
-* Change in IPv4Addr 0.06
-
- - Module was renamed to Net::IPv4Addr to better fit into CPAN hierarchy.
-
View
41 deps/Net-IPv4Addr/README
@@ -1,41 +0,0 @@
-Net::IPv4Addr
-=================
-
-Version: 0.10
-
-Description
------------
-
-Net::IPv4Addr provides functions for parsing IPv4 addresses both
-in traditional address/netmask format and in the new CIDR format.
-There are also methods for calculating the network and broadcast
-address and also to see check if a given address is in a specific
-network.
-
-Installing
-----------
-
-The usual:
-
- perl Makefile.PL
- make
- make install
-
-Documentation
--------------
-
-Documentation is included in pod format.
-
-Bugs
-----
-
-Send bug reports and suggestions to bugs@iNsu.COM.
-
-Copyright
----------
-
-Copyright (c) 1999,2000 iNsu Innovations Inc .
-All rights reserved.
-
-This package is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
View
1  deps/Net-IPv4Addr/VERSION
@@ -1 +0,0 @@
-0.10
View
37 deps/Net-IPv4Addr/debian/changelog
@@ -1,37 +0,0 @@
-libnetwork-ipv4addr-perl (0.09-2) frozen unstable; urgency=high
-
- * fixed bug #66073 and fixed bug #66080
- * changed maintainer email address to @debian.org
- * fixed section and standards version
-
- -- Bernd Eckenfels <ecki@debian.org> Sat, 22 Jul 2000 07:02:12 +0200
-
-
-libnetwork-ipv4addr-perl (0.09-1) frozen unstable; urgency=high
-
- * in this version #63482 is not visible anymore (fixed i guess)
- * fixed security bug (#63529)
-
- -- Bernd Eckenfels <ecki@debian.org> Thu, 4 May 2000 05:50:32 +0200
-
-libnetwork-ipv4addr-perl (0.07-2) unstable; urgency=low
-
- * fixed bug with 5.005 pl3 (Bug#49609:) thanks to Bitkoenig!
-
- -- Bernd Eckenfels <ecki@debian.org> Tue, 9 Nov 1999 03:05:41 +0100
-
-libnetwork-ipv4addr-perl (0.07-1) unstable; urgency=low
-
- * new version, including a full working debian/ subdir, thanks Francis
-
- -- Bernd Eckenfels <ecki@debian.org> Sat, 23 Oct 1999 20:19:13 +0200
-
-libnetwork-ipv4addr-perl (0.05-1) unstable; urgency=low
-
- * Initial Release.
-
- -- Bernd Eckenfels <ecki@debian.org> Sat, 25 Sep 1999 01:26:34 +0200
-
-Local variables:
-mode: debian-changelog
-End:
View
12 deps/Net-IPv4Addr/debian/control
@@ -1,12 +0,0 @@
-Source: libnetwork-ipv4addr-perl
-Section: interpreters
-Priority: optional
-Maintainer: Bernd Eckenfels <ecki@debian.org>
-Standards-Version: 3.0.1
-
-Package: libnetwork-ipv4addr-perl
-Architecture: all
-Depends: ${perl:Depends}
-Description: The Net::IPv4Addr perl module API and ipv4calc script
- ipv4calc can be used to calculate netmask, broadcast and netaddress of
- an IPv4 (Internet) address.
View
14 deps/Net-IPv4Addr/debian/copyright
@@ -1,14 +0,0 @@
-This package was debianized by Bernd Eckenfels <ecki@lina.inka.de> on
-Sat, 25 Sep 1999 01:26:34 +0200.
-
-It was downloaded from http://iNDev.iNsu.COM/IPv4Addr/
-
-Upstream Author(s): Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
-Copyright:
-
-Copyright (c) 1999 Francis J. Lacoste and iNsu Innovations Inc .
-All rights reserved.
-
-This package is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
View
4 deps/Net-IPv4Addr/debian/dirs
@@ -1,4 +0,0 @@
-usr/bin
-usr/lib/perl5/Net/
-usr/share/man/man1
-usr/share/man/man3
View
4 deps/Net-IPv4Addr/debian/docs
@@ -1,4 +0,0 @@
-README
-NEWS
-IPv4Addr.spec
-
View
85 deps/Net-IPv4Addr/debian/rules
@@ -1,85 +0,0 @@
-#!/usr/bin/make -f
-#-*- makefile -*-
-# Made with the aid of dh_make, by Craig Small
-# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
-# Some lines taken from debmake, by Christoph Lameter.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# This is the debhelper compatability version to use.
-export DH_COMPAT=1
-
-ifndef PERL
-PERL = /usr/bin/perl
-endif
-
-TMP =`pwd`/debian/tmp
-#archlib =`$(PERL) -MConfig -e 'print $$Config{installarchlib}'`
-#config =INSTALLDIRS=perl INSTALLMAN1DIR=$(TMP)/usr/share/man/man1 INSTALLMAN3DIR=$(TMP)/usr/share/man/man3 INSTALLPRIVLIB=$(TMP)/usr/lib/perl5 INSTALLARCHLIB=$(TMP)$(archlib)
-
-build: build-stamp
-build-stamp:
- dh_testdir
- # Add here commands to compile the package.
- $(PERL) Makefile.PL
- $(MAKE)
- touch build-stamp
-
-clean:
- dh_testdir
- rm -f build-stamp install-stamp
- # Add here commands to clean up after the build process.
- -$(MAKE) clean
- -rm -rf blib/ Makefile.old Makefile
- dh_clean
-
-install: install-stamp
-install-stamp: build-stamp
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
- install -m 755 blib/script/ipv4calc debian/tmp/usr/bin
- install -m 644 blib/lib/Net/IPv4Addr.pm debian/tmp/usr/lib/perl5/Net/IPv4Addr.pm
- touch install-stamp
-
-# Build architecture-independent files here.
-binary-indep: build install
-# dh_testversion
- dh_testdir
- dh_testroot
- dh_installdocs
- dh_installexamples
-# dh_installmenu
-# dh_installemacsen
-# dh_installpam
- dh_installinit
- dh_installcron
- dh_installmanpages
-# dh_installinfo
-# dh_undocumented
- dh_installchangelogs ChangeLog
- dh_link
- dh_strip
- dh_compress
- dh_fixperms
- # You may want to make some executables suid here.
- dh_suidregister
-# dh_makeshlibs
- dh_installdeb
- dh_perl
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dpkg --build debian/tmp ..
-
-# Build architecture-dependent files here.
-binary-arch: build install
-# We have nothing to do by default.
-
-source diff:
- @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
View
89 deps/Net-IPv4Addr/ipv4calc
@@ -1,89 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use Net::IPv4Addr qw (:all);
-use Getopt::Long;
-
-my %opts = ();
-
-sub usage() {
- die <<EOU;
-usage: ipv4calc [--network | --broadcast | --netmask |
- --cidr | --address ] addr
-EOU
-}
-
-GetOptions( \%opts, "network", "broadcast", "netmask", "cidr", "address")
- or usage;
-
-my $str = shift;
-$str or usage;
-
-my ($ip,$cidr) = ipv4_parse($str);
-my ($network,$msk) = ipv4_network($ip,$cidr);
-my ($broadcast) = ipv4_broadcast($ip,$cidr);
-
-if ( $opts{network}) {
- print $network,"\n";
-} elsif ($opts{broadcast}) {
- print $broadcast,"\n";
-} elsif ( $opts{netmask} ) {
- print ipv4_cidr2msk( $msk ), "\n";
-} elsif ( $opts{address} ) {
- print $ip, "\n";
-} elsif ( $opts{cidr} ) {
- print $msk, "\n";
-} else {
- print <<EOF;
-Host: $ip
-Network: $network/$msk
-Broadcast: $broadcast
-EOF
-}
-
-1;
-
-__END__
-# Below is the stub of documentation for your module. You better edit it!
-=pod
-
-=head1 NAME
-
- ipv4calc - Calculates IPv4 elements from an address.
-
-=head1 SYNOPSIS
-
- ipv4calc [ --network | --broadcast | --netmask |
- --address | --cidr ] addr
-
-=head1 DESCRIPTION
-
-If an option is specified B<ipv4calc> calculates the requested element
-from the address and prints it on stdout.
-
-If multiple options are specified, only the first one is printed.
-
-If no options are specified, the program prints the host part of the
-address, the network and the broadcast address as deduced from the
-given address.
-
-If address doesn't contains a netmask or mask length, the default
-one is assumed.
-
-=head1 AUTHOR
-
-Francis J. Lacoste <francis.lacoste@iNsu.COM>
-
-=head1 COPYRIGHT
-
-Copyright (c) 1999,2000 iNsu Innovations Inc.
-All rights reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms as perl itself.
-
-=head1 SEE ALSO
-
-Network::IPv4Addr(3).
-
-=cut
View
68 deps/Net-IPv4Addr/test.pl
@@ -1,68 +0,0 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl test.pl'
-
-use strict;
-use Test;
-
-# Change 1..1 below to 1..last_test_to_print .
-# (It may become useful if the test is moved to ./t subdirectory.)
-
-BEGIN { plan tests => 37 }
-use Net::IPv4Addr qw(/^ipv4/);
-
-
-# ipv4_parse
-ok( scalar ipv4_parse( "127.0.0.1" ), "127.0.0.1" );
-ok( scalar ipv4_parse( "192.168.100.1 / 24" ), "192.168.100.1/24" );
-ok( scalar ipv4_parse( "130.10.2.10", "255.255.255.0"), "130.10.2.10/24");
-ok( scalar ipv4_parse( "130.10.2.10", "255.255.255.240"), "130.10.2.10/28");
-ok( scalar ipv4_parse( "130.10.2.10/28"), "130.10.2.10/28");
-
-# ipv4_dftl_netmask
-ok( ipv4_dflt_netmask( "127.0.0.1" ), "255.0.0.0" );
-ok( ipv4_dflt_netmask( "172.0.0.01" ), "255.255.0.0" );
-ok( ipv4_dflt_netmask( "198.0.0.20" ), "255.255.255.0" );
-
-# ipv4_network
-ok( scalar ipv4_network( "127.0.0.1"), "127.0.0.0/8" );
-ok( scalar ipv4_network( "192.168.100.10" ), "192.168.100.0/24" );
-ok( scalar ipv4_network( "192.168.100.100/255.255.255.192"), "192.168.100.64/26" );
-
-# ipv4_broadcast
-ok( ipv4_broadcast( "127.0.0.1"), "127.255.255.255" );
-ok( ipv4_broadcast( "192.168.100.10/24" ), "192.168.100.255" );
-ok( ipv4_broadcast( "192.168.100.100/255.255.255.192"), "192.168.100.127" );
-
-# ipv4_in_network
-ok( ipv4_in_network( "127.0.0.1", "127.0.0.1" ) );
-ok( not ipv4_in_network( "127.0.0.0/8", "192.168.30.1" ));
-ok( not ipv4_in_network( "192.168.100.10", "192.168.100.30"));
-ok( ipv4_in_network( "192.168.100.10/24", "192.168.100.255"));
-ok( ipv4_in_network( "192.168.100.0/24", "192.168.100.0"));
-ok( not ipv4_in_network( "192.16.100.63/26", "192.168.100.65"));
-ok( ipv4_in_network( "192.168.100.0/24", "0.0.0.0" ) );
-ok( ipv4_in_network( "192.168.100.0/24", "255.255.255.255" ) );
-ok( ipv4_in_network( "0.0.0.0", "192.168.1.1" ) );
-ok( ipv4_in_network( "255.255.255.255", "192.176.1.8" ) );
-ok( ipv4_in_network( "192.168.199.0/30", "192.168.199.1" ) );
-ok( ipv4_in_network( "212.117.64.0/19", "212.117.65.42/28" ) );
-ok( !ipv4_in_network( "21.10.0.4/24", "0.0.0.0/0" ) );
-
-# ipv4_cidr2msk
-ok( ipv4_cidr2msk( 24 ), "255.255.255.0" );
-ok( ipv4_cidr2msk( 16 ), "255.255.0.0" );
-ok( ipv4_cidr2msk( 8 ), "255.0.0.0" );
-ok( ipv4_cidr2msk( 26 ), "255.255.255.192" );
-ok( ipv4_cidr2msk( 0 ), "0.0.0.0" );
-ok( ipv4_cidr2msk( 32 ), "255.255.255.255" );
-
-# ipv4_msk2cidr
-ok( ipv4_msk2cidr( "255.255.255.0" ), 24);
-ok( ipv4_msk2cidr( "255.255.0.0" ), 16 );
-ok( ipv4_msk2cidr( "255.0.0.0" ), 8 );
-ok( ipv4_msk2cidr( "255.255.255.192" ), 26 );
-ok( ipv4_msk2cidr( "0.0.0.0" ), 0 );
-ok( ipv4_msk2cidr( "255.255.255.255" ), 32 );
-
-
-
View
131 deps/NetAddr-IP/Artistic
@@ -0,0 +1,131 @@
+
+
+
+
+ The "Artistic License"
+
+ Preamble
+
+The intent of this document is to state the conditions under which a
+Package may be copied, such that the Copyright Holder maintains some
+semblance of artistic control over the development of the package,
+while giving the users of the package the right to use and distribute
+the Package in a more-or-less customary fashion, plus the right to make
+reasonable modifications.
+
+Definitions:
+
+ "Package" refers to the collection of files distributed by the
+ Copyright Holder, and derivatives of that collection of files
+ created through textual modification.
+
+ "Standard Version" refers to such a Package if it has not been
+ modified, or has been modified in accordance with the wishes
+ of the Copyright Holder as specified below.
+
+ "Copyright Holder" is whoever is named in the copyright or
+ copyrights for the package.
+
+ "You" is you, if you're thinking about copying or distributing
+ this Package.
+
+ "Reasonable copying fee" is whatever you can justify on the
+ basis of media cost, duplication charges, time of people involved,
+ and so on. (You will not be required to justify it to the
+ Copyright Holder, but only to the computing community at large
+ as a market that must bear the fee.)
+
+ "Freely Available" means that no fee is charged for the item
+ itself, though there may be fees involved in handling the item.
+ It also means that recipients of the item may redistribute it
+ under the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications
+derived from the Public Domain or from the Copyright Holder. A Package
+modified in such a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided
+that you insert a prominent notice in each changed file stating how and
+when you changed that file, and provided that you do at least ONE of the
+following:
+
+ a) place your modifications in the Public Domain or otherwise make them
+ Freely Available, such as by posting said modifications to Usenet or
+ an equivalent medium, or placing the modifications on a major archive
+ site such as uunet.uu.net, or by allowing the Copyright Holder to include
+ your modifications in the Standard Version of the Package.
+
+ b) use the modified Package only within your corporation or organization.
+
+ c) rename any non-standard executables so the names do not conflict
+ with standard executables, which must also be provided, and provide
+ a separate manual page for each non-standard executable that clearly
+ documents how it differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or
+executable form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files,
+ together with instructions (in the manual page or equivalent) on where
+ to get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of
+ the Package with your modifications.
+
+ c) give non-standard executables non-standard names, and clearly
+ document the differences in manual pages (or equivalent), together
+ with instructions on where to get the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package. You may charge any fee you choose for support of this
+Package. You may not charge a fee for this Package itself. However,
+you may distribute this Package in aggregate with other (possibly
+commercial) programs as part of a larger (possibly commercial) software
+distribution provided that you do not advertise this Package as a
+product of your own. You may embed this Package's interpreter within
+an executable of yours (by linking); this shall be construed as a mere
+form of aggregation, provided that the complete Standard Version of the
+interpreter is so embedded.
+
+6. The scripts and library files supplied as input to or produced as
+output from the programs of this Package do not automatically fall
+under the copyright of this Package, but belong to whoever generated
+them, and may be sold commercially, and may be aggregated with this
+Package. If such scripts or library files are aggregated with this
+Package via the so-called "undump" or "unexec" methods of producing a
+binary executable image, then distribution of such an image shall
+neither be construed as a distribution of this Package nor shall it
+fall under the restrictions of Paragraphs 3 and 4, provided that you do
+not represent such an executable image as a Standard Version of this
+Package.
+
+7. C subroutines (or comparably compiled subroutines in other
+languages) supplied by you and linked into this Package in order to
+emulate subroutines and variables of the language defined by this
+Package shall not be considered part of this Package, but are the
+equivalent of input as in Paragraph 6, provided these subroutines do
+not change the language in any way that would cause it to fail the
+regression tests for the language.
+
+8. Aggregation of this Package with a commercial distribution is always
+permitted provided that the use of this Package is embedded; that is,
+when no overt attempt is made to make this Package's interfaces visible
+to the end user of the commercial distribution. Such use shall not be
+construed as a distribution of this Package.
+
+9. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+ The End
View
464 deps/NetAddr-IP/Changes
@@ -0,0 +1,464 @@
+Revision history for Perl extension NetAddr::IP
+
+4.058 Fri Nov 11 19:23:11 PST 2011
+ up rev for documentation update
+ update documentation in InetBase v0.06
+
+4.057 Fri Nov 11 15:04:20 PST 2011
+ Lite.pm v1.40
+ add call to InetBase::fillIPv4 to all uses of gethostbyname
+
+ break out the code in InetBase v0.05 that expands short IPv4
+ addresses into dotquad format to account for broken BSD
+ implementations of inet_aton and gethostbyname that do
+ not recognize the short format. EXPORT this as sub 'fillIPv4'
+
+ in Util.pm v1.45, add 'fillIPv4' to calls to gethostbyname to
+ work around broken inet_aton and gethostbyname implementations
+ in certain BSD implementations
+
+4.056 Wed Nov 2 19:15:31 PDT 2011
+ bump rev to incorporate
+ improved inet_aton in InetBase v0.04 to overcome broken
+ gethostbyname found in NetBSD and OpenBSD
+
+4.055 Fri Oct 28 11:41:22 PDT 2011
+ in Lite.pm v1.38
+ patch for bug 71869, issues with Math::BigInt varients
+
+4.054 Thu Oct 27 12:48:55 PDT 2011
+ In Lite.pm v1.37, remove Calc.pm
+ add detection of early Math::Bigint object structure
+ fix bug 71869 - a failed test routine
+
+4.053 Wed Oct 26 08:52:34 PDT 2011
+ In Lite.pm v1.36
+ fix bug #71925. A a sub-varient of #62521 that showed up only for
+ short notation for IPv4. i.e. 127/n, 127.0/n, 127.0.0/n but
+ not 127.0.0.0/n
+
+4.052 Tue Oct 25 16:18:38 PDT 2011
+ add test in Lite.pm v1.35 for api-version of Math::BigInt to
+ support versions earlier than 1.70, circa Dec 2003.
+ Thanks to Paul Howarth <paul@city-fan.org> for spotting that bug.
+
+4.051 Mon Oct 24 14:44:53 PDT 2011
+ fix bug 71869
+ in Lite.pm v1.34
+ use Math::BigInt::Calc for creating BigInt values and fall
+ back to NetAddr::IP::Calc if Math::BigInt is not present.
+
+ remove reference to Config{osname} in InetBase.pm v0.03
+ (Util 1.43)
+
+
+4.050 Sat Oct 22 01:58:57 PDT 2011
+ In Lite/Util/lib/NetAddr/IP/Lite/Util/InetBase.pm v0.02
+ Socket6 prior to version 0.23 does not have AF_INET6 in the
+ EXPORT_OK array, modify InetBase.pm v0.2 to work around this.
+
+ Add support for Math::BigInt to NetAddr::IP::Lite v1.33
+
+4.049 Sat Oct 15 22:15:10 PDT 2011
+ Updates to Lite.pm, Util.pm, new module InetBase.pm
+
+ In Lite v1.32
+ bug68723, add capability to parse input of the form
+ ->new6(12345,1). This should have been there but was
+ missing. Thanks to Andrei Benea for spotting this.
+
+ In Util v1.41
+ add inet_pton, inet_ntop, AF_INET, AF_INET6
+
+ modify inet_n2dx and inet_n2ad to
+ recognize the new 128 bit IPv4 format
+ ::FFFF:FFFF:0:0
+
+ replace isIPv4 with a pure perl version for portablity
+
+ split the following into NetAddr::IP::InetBase v0.01
+ to provide better long term support for IPv6
+ inet_aton
+ inet_ntoa
+ ipv6_aton
+ ipv6_n2x
+ ipv6_n2d
+ inet_any2n
+ inet_n2dx
+ inet_n2ad
+ inet_ntop
+ inet_pton
+ packzeros
+ isIPv4
+ isNewIPv4
+ isAnyIPv4
+ AF_INET
+ AF_INET6
+
+4.048 Sat Oct 8 01:33:44 PDT 2011
+ remove debug print statement from Util v1.40
+
+4.047 Thu Oct 6 23:41:42 PDT 2011
+ really correct missing reference in Util v1.39
+ doc update only in Lite.pm v1.30
+
+4.046 Thu Oct 6 20:20:33 PDT 2011 DEPRECATED
+ corrected missing reference to inet_4map6 in Util v1.38
+
+4.045 Thu Oct 6 18:23:04 PDT 2011 DEPRECATED
+ updated NetAddr::IP::Util 1.37
+ addid isAnyIPv4, isNewIPv4, inet_4map6
+ revised naip_gethostbyname
+ to conform to Perl's gethostbyname output
+
+4.044 Wed May 18 14:47:34 PDT 2011
+ added missing support for ->compactref(\@list) which is described
+ in the documentation but not implemented.
+
+ Thanks to Rusty Bourland codebard@gmail.com for spotting this
+ and providing both a patch and test code
+
+4.043 Wed Apr 6 11:31:19 PDT 2011
+ Update documentation on the use of "adding constants
+ to an IP address".
+
+4.042 Tue Mar 22 15:26:02 PDT 2011
+ Update Lite.pm v1.27 to encompass treatment of /31 and /127
+ point-to-point networks as described in RFC 3021
+
+ NOTE: for /31's and /127's
+ this changes the behavior of the following methods:
+ first returns the "network" address
+ last returns the "broadcast" address
+ nth index 0 returns "network" addr instead of undef
+ nth index 1 returns "broadcast" addr instead of undef
+ num returns 2 instead of 0 (zero)
+
+ "old_nth" behavior is unchanged
+
+ Thanks to Todd Caine todd.caine@gmail.com for pointing this out.
+
+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@plosquare.com for finding this bug
+
+4.040 Sat Feb 19 10:04:00 PST 2011
+ correction to use of Util.pm package lexicals
+
+ thanks to mishikal@yahoo.com for spotting the bug and to
+ Mark Martinec mark.martinec+ama...@ijs.si for the solution.
+
+4.039 Wed Feb 16 15:48:03 PST 2011
+ Correct documentation for 'split' methods
+
+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
+ in Lite.pm v1.23 and IP.pm
+ add test for :lower in Lite.pm v1.23
+
+4.036 Tue Nov 16 16:28:37 PST 2010
+ In Util.pm v1.35, naip_gethostbyname modified to return undef
+ instead of 0 (zero) on failure
+
+ thanks to Terry Cassidy enaudishaylee@tc17.com for the bug report
+
+ In Util.pm v1.35, move sub's ipv6_n2d and ipv6_n2x to non-autosplit
+ portion of module to eliminate warnings during autosplit of "our"
+ variables
+
+ thanks to Nicholas Bamber <nicholas@periapt.co.uk>
+ Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=517361
+
+ In Lite.pm v1.22, update new6 to properly classify short ipv4 notation
+ i.e. 127/8 with test for ":" rather than match for \d.\d.\d.\d
+
+ thanks to Steve Huff (SHUFF) * shuff@cpan.org for
+ spotting that bug.
+
+ In Lite.pm v1.22, update t/v4-new.t for deprecated array syntax in
+ perl 5.13
+ was: qw(...stuff...)
+ is: (qw(...stuff...))
+
+ thanks to Todd Rinaldo <toddr@cpan.org> for reporting this
+
+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@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@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
+
+4.032 Wed Sep 22 13:39:08 PDT 2010
+ Added overload => 'ne' and '!=' to Lite.pm v1.18
+
+4.031 Tue Sep 21 19:21:04 PDT 2010
+ Pull Socket6 stuff out of Lite 1.17 and put into
+ 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
+ gethostbyname6 to determine whether to set ipV6 flag
+
+ Thanks to Dusty Mabe <Dusty.Mabe@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
+
+ Thanks to "Mabe, Dusty" <Dusty.Mabe@tekelec.com> for spotting
+ this and suggesting a fix.
+
+4.028 Wed May 12 14:18:20 PDT 2010
+ In /Lite/Util/Util.xs v1.32,
+ changed netswap() to postincrement
+ *a++ = to *a and added increment after save to mollify some
+ picky compilers that return possible undefined behavior.
+
+ changed type of _128x10 to 'void'
+
+ Thanks to David Bolt <dbolt@davjam.org> for the above two patches
+
+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
+
+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
+
+4.025 Sat Mar 7 16:15:18 PST 2009
+ revised compiler test in Makefile.PL for Util v1.29
+ to accomodate picky Solaris "cc"
+
+4.024 Mon Jan 26 00:27:32 PST 2009
+ documentation update
+
+4.023 Fri Jan 16 14:30:40 PST 2009
+ added the capability to set the CASE of ipV6 text return
+ values to either upper or lower. Thanks to
+ Rob Riepel <riepel@networking.Stanford.EDU> for developing
+ this improvement and providing a comprehensive patch
+
+4.022 Sat Dec 20 13:05:01 PST 2008
+ In Util.xs 1.28
+ set uninitialized "carry" in XS bin2bcd to zero
+
+ This insidious bug only showed up on 64 bit hosts running perl 5.6.2
+ Thanks to Oliver Paukstadt <pstadt@sourcentral.org> for taking the
+ time to do the testing for me on his s390 system.
+
+4.021 Wed Dec 10 11:09:36 PST 2008
+ Removed test code that produces a warning about all perl versions,
+ OOPS!! instead of just the buggy 5.8.0 - 5.8.5 versions.
+ Thanks to paul@city-fan.org for reporting this.
+
+4.020 Tue Dec 9 16:25:46 PST 2008
+ cleaned up various typo's with good patch from
+ Rob Riepel <riepel@networking.Stanford.EDU>
+ thanks Rob.
+
+ revised UtilPP v1.7 to work around perl 5.8.4
+ failures with certain @_ operations of goto &sub...
+ see perl bug [ 23429]. Unfortunately, perl-5.8.4 is
+ the distribution of choice for many solaris boxes
+
+4.019 Sat Nov 29 15:15:30 PST 2008
+ in Lite/Util, add pure perl testing to XS build
+
+4.018 Fri Nov 28 23:19:01 PST 2008
+ revised XS code to be full re-entrant, thread safe in Util.xs v1.26
+ removed all traces of mutex locks in Util.xs v1.26
+ removed function 'threads' here an in UtilPP v1.6
+
+4.017 Sun Nov 23 19:32:59 PST 2008
+ Extended the capability of 'splitref' to allow splitting of
+ objects into multiple pieces with differing CIDR masks.
+ Returned object list can be split from bottom to top
+ or from top to bottom depending on which method is called
+
+ split, rsplit, splitref, rsplitref
+
+ Thanks to kashmish <kashmish@gmail.com> for the idea on
+ improving functionality of 'split'.
+
+ Thanks to Rob Riepel <riepel@networking.Stanford.EDU>
+ for a faster and more accurate _compV6 function.
+
+ in UtitPP v1.5
+ correct documentation error
+ add threads reporting (empty string)
+
+ in Util v1.25
+ add threads reporting that returns a comma separated
+ string of build headers.
+
+ added what is hopefully thread safe operation via
+ serialization. Must be invoked by "--with-threads"
+
+ in Lite v1.12
+ corrected missing Zeros subroutine
+ Zeros and Zero both will work
+
+ in Lite v1.12
+ added minus (-) overloading to allow the subtraction
+ of two NetAddr::IP objects to get the difference between
+ the object->{addr}'s as a numeric value
+ Thanks to Rob Riepel <riepel@networking.Stanford.EDU>
+ for the initial code and inspiration for this enhancement
+
+4.016 Wed Nov 5 18:13:20 PST 2008
+ in Util/ version 1.24
+ Clean up Makefile.PL to check actual required link
+ libraries against the perl build for consistency
+
+4.015 Sun Nov 2 10:10:38 PST 2008
+ in Util v1.23 add missing headers in configure and localconf.h
+ for Solaris inet_xton
+ thanks to Karl Bunch <karl@digilink.net> for spotting the bug.
+
+4.014 Sat Nov 1 15:13:48 PST 2008
+ in Lite.pm v1.11, add test for characters not allowed by
+ rfc952 before the call to gethostbyname in sub new() for those
+ people that insist on using deprecated functionality :aton
+ and OS's that fail to notice calls to gethostbyname with
+ binary arguments.
+
+4.013 Wed Oct 22 15:04:49 PDT 2008
+ In Lite.pm v1.10, add new no octal method for
+ improperly formatted ipV4 addresses
+
+ In Util.pm v1.22, eliminated dependence on PL_sawampersand
+ thanks to Mark Martinec <Mark.Martinec@ijs.si>
+ for spotting this and submitting a patch.
+
+ In Util.pm v1.22, force -noxs mode for Win32
+
+ In Util.pm v1.22, use autoconf to configure 'C' build
+
+4.012 Thu Oct 16 19:35:33 PDT 2008
+ clear build bug for Win32 in Util.pm v 1.21
+
+4.011 released Oct 6 13:10
+
+4.010 Sat Sep 27 17:00:28 PDT 2008
+ in NetAddr::IP::Util v0.19
+ updated test for ENDIANess in siteconf
+
+ add test in inet_aton to detect overange IP dot quad values
+ missed by some broken Socket implementations
+ i.e. 256.1.1.1 would fail to return undef
+
+NOTE: Versions 4.008 and 4.009 had limited release to tester only
+ and were not uploaded to CPAN. All of the v4.008, 4.009
+ changes are incorporated in v4.010
+
+4.009 Tue Sep 2 19:09:57 PDT 2008
+ In NetAddr::IP::Lite v1.07,
+ in the off chance that NetAddr::IP::Lite objects are created
+ and the caller later loads NetAddr::IP and expects to use
+ those objects, let the AUTOLOAD routine find and redirect
+ NetAddr::IP::Lite method and subroutine calls to NetAddr::IP.
+
+ updated Lite/t/v4-wnew.t so that non-existent
+ domains are "really" not there
+
+4.008 Sat Jun 7 14:01:55 PDT 2008
+ inherit method "new_from_aton" from NetAddr::IP::Lite
+ add related documentation
+
+ Inherited methods from Lite.pm updated as follows:
+
+ comparisons of the form <, >, <=, >=
+ 10.0.0.0/24 {operator} 10.0.0.0/16
+ return now return the comparison of the cidr value
+ when the address portion is equal.
+NOTE: this comparison returns the comparison of the NUMERIC
+ value of the CIDR. This produces the counter intuitive result
+ that /24 > /16. There is logic to this, really! For proper
+ operation of commands like "Compact" and "Coalesce", lists of
+ netaddr objects must sort in ascending order. However, this
+ conflicts with the requirement for larger netblocks to sort
+ FIRST so as to include smaller ones. This logic extends to
+ any requirement for a sort of netaddr objects. It should be
+ further noted that the mixing of netaddr objects with varying
+ IP addresses and CIDR allocations can lead to unexpected
+ results since the comparisons done first on the IP portion
+ and then on the CIDR portion. The documentation has been
+ updated appropriately.
+ Thanks to Peter DeVries for spotting this discrepancy
+
+4.007 Wed Jun 6 16:41:11 VET 2007
+ Update copyright dates
+
+4.006 Wed Jun 6 15:58:04 VET 2007
+
+ A patch from Michael got rid of $& and $` as reported by Daryl
+ O'Shea and documented at
+ http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5312
+
+4.004 Wed Aug 16 16:01:54 PDT 2006
+ update to include/exclude files in corrupted distro
+
+4.003 Sun Aug 6 10:48:25 PDT 2006
+ correct SYNOPSIS documentation
+ add :old_nth
+
+ update Lite.pm documentation
+ update Util.pm documentation
+ Imported into distribution CVS tree - Some revision number
+ mismatches are to be expected
+ Latin-1 is back
+ Fixed some angle brackets so that they show up in the docs
+
+4.002 Fri Aug 4 14:14:16 PDT 2006
+ remove unused global variable $isV6
+
+ update Lite.pm to v1.02
+ $isV6 global converted to a lexical variable within sub "_xnew"
+ $Class global removed and replaced by calls to UNIVERSAL::isa
+ Thanks to julian@mehnle.net for spotting problems related to
+ using the Lite.pm with mod_perl
+
+4.001 Thu Jul 6 14:09:01 PDT 2006
+ various bug fixes courtesy of Luis Munoz:
+ changes to Lite.pm v1.01, Util.pm v0.17 see Changes in those distros.
+ update t/v6-re.t, addconst called as a scalar, should be called to
+ return the address value ()[1]
+
+4.000 Mon Jun 19 21:51:10 PDT 2006
+ initial release of version 4.000 which includes
+ full support of ipV6 addresses and drops the requirement
+ for Math::BigInt and will run on older versions of Perl
+ at least back to 5.005_03
+
View
339 deps/NetAddr-IP/Copying
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+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
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ 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
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+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
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+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
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ 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
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+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
+
+ 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
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ 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.
+
+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'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show 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
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+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.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+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
+Public License instead of this License.
View
1,572 deps/NetAddr-IP/IP.pm
@@ -0,0 +1,1572 @@
+#!/usr/bin/perl -w
+
+package NetAddr::IP;
+
+use strict;
+#use diagnostics;
+use NetAddr::IP::Lite 1.41 qw(Zero Zeros Ones V4mask V4net);
+use NetAddr::IP::Util 1.46 qw(
+ sub128
+ inet_aton
+ inet_any2n
+ ipv6_aton
+ isIPv4
+ ipv4to6
+ mask4to6
+ shiftleft
+ addconst
+ hasbits
+ notcontiguous
+);
+
+use AutoLoader qw(AUTOLOAD);
+
+use vars qw(
+ @EXPORT_OK
+ @EXPORT_FAIL
+ @ISA
+ $VERSION
+ $_netlimit
+);
+require Exporter;
+
+@EXPORT_OK = qw(Compact Coalesce Zero Zeros Ones V4mask V4net netlimit);
+@EXPORT_FAIL = qw($_netlimit);
+
+@ISA = qw(Exporter NetAddr::IP::Lite);
+
+$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.58 $ =~ /\d+/g) };
+
+=pod
+
+=head1 NAME
+
+NetAddr::IP - Manages IPv4 and IPv6 addresses and subnets
+
+=head1 SYNOPSIS
+
+ use NetAddr::IP qw(
+ Compact
+ Coalesce
+ Zeros
+ Ones
+ V4mask
+ V4net
+ netlimit
+ :aton DEPRECATED
+ :lower
+ :upper
+ :old_storable
+ :old_nth
+ );
+
+ NOTE: NetAddr::IP::Util has a full complement of network address
+ utilities to convert back and forth between binary and text.
+
+ inet_aton, inet_ntoa, ipv6_aton, ipv6_ntoa
+ ipv6_n2x, ipv6_n2d inet_any2d, inet_n2dx,
+ inet_n2ad, inetanyto6, ipv6to4
+
+See L<NetAddr::IP::Util>
+
+
+ my $ip = new NetAddr::IP::Lite '127.0.0.1';
+ or if your prefer
+ my $ip = NetAddr::IP::Lite->new('127.0.0.1);
+ or from a packed IPv4 address
+ my $ip = new_from_aton NetAddr::IP::Lite (inet_aton('127.0.0.1'));
+ or from an octal filtered IPv4 address
+ my $ip = new_no NetAddr::IP::Lite '127.012.0.0';
+
+ print "The address is ", $ip->addr, " with mask ", $ip->mask, "\n" ;
+
+ if ($ip->within(new NetAddr::IP "127.0.0.0", "255.0.0.0")) {
+ print "Is a loopback address\n";
+ }
+
+ # This prints 127.0.0.1/32
+ print "You can also say $ip...\n";
+
+* The following four functions return ipV6 representations of:
+
+ :: = Zeros();
+ FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF = Ones();
+ FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:: = V4mask();
+ ::FFFF:FFFF = V4net();
+
+
+###### DEPRECATED, will be remove in version 5 ############
+
+ * To accept addresses in the format as returned by
+ inet_aton, invoke the module as:
+
+ use NetAddr::IP qw(:aton);
+
+###### USE new_from_aton instead ##########################
+
+* To enable usage of legacy data files containing NetAddr::IP
+objects stored using the L<Storable> module.
+
+ use NetAddr::IP qw(:old_storable);
+
+* To compact many smaller subnets (see: C<$me-E<gt>compact($addr1,$addr2,...)>
+
+ @compacted_object_list = Compact(@object_list)
+
+* Return a reference to list of C<NetAddr::IP> subnets of
+C<$masklen> mask length, when C<$number> or more addresses from
+C<@list_of_subnets> are found to be contained in said subnet.
+
+ $arrayref = Coalesce($masklen, $number, @list_of_subnets)
+
+* By default B<NetAddr::IP> functions and methods return string IPv6
+addresses in uppercase. To change that to lowercase:
+
+NOTE: the AUGUST 2010 RFC5952 states:
+
+ 4.3. Lowercase
+
+ The characters "a", "b", "c", "d", "e", and "f" in an IPv6
+ address MUST be represented in lowercase.
+
+It is recommended that all NEW applications using NetAddr::IP be
+invoked as shown on the next line.
+
+ use NetAddr::IP qw(:lower);
+
+* To ensure the current IPv6 string case behavior even if the default changes:
+
+ use NetAddr::IP qw(:upper);
+
+* To set a limit on the size of B<nets> processed or returned by NetAddr::IP.
+
+Set the maximum number of nets beyond which NetAddr::IP will return and
+error as a power of 2 (default 16 or 65536 nets). Each 2**16 consumes approximately 4 megs of
+memory. A 2**20 consumes 64 megs of memory, A 2**24 consumes 1 gigabyte of
+memory.
+
+ use NetAddr::IP qw(netlimit);
+ netlimit 20;
+
+The maximum B<netlimit> allowed is a 2**24. Attempts to set limits below the
+default of 16 or above the maximum of 24 are ignored.
+
+Returns true on success otherwise undef.
+
+=cut
+
+$_netlimit = 2 ** 16; # default
+
+sub netlimit($) {
+ return undef unless $_[0];
+ return undef if $_[0] =~ /\D/;
+ return undef if $_[0] < 16;
+ return undef if $_[0] > 24;
+ $_netlimit = 2 ** $_[0];
+};
+
+=head1 INSTALLATION
+
+Un-tar the distribution in an appropriate directory and type:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+B<NetAddr::IP> depends on B<NetAddr::IP::Util> which installs by default with its primary functions compiled
+using Perl's XS extensions to build a 'C' library. If you do not have a 'C'
+complier available or would like the slower Pure Perl version for some other
+reason, then type:
+
+ perl Makefile.PL -noxs
+ make
+ make test
+ make install
+
+=head1 DESCRIPTION
+
+This module provides an object-oriented abstraction on top of IP
+addresses or IP subnets, that allows for easy manipulations.
+Version 4.xx of NetAdder::IP will will work with older
+versions of Perl and is compatible with Math::BigInt.
+
+The internal representation of all IP objects is in 128 bit IPv6 notation.
+IPv4 and IPv6 objects may be freely mixed.
+
+=head2 Overloaded Operators
+
+Many operators have been overloaded, as described below:
+
+=cut
+
+ #############################################
+ # These are the overload methods, placed here
+ # for convenience.
+ #############################################
+
+use overload
+
+ '@{}' => sub {
+ return [ $_[0]->hostenum ];
+ };
+
+=pod
+
+=over
+
+=item B<Assignment (C<=>)>
+
+Has been optimized to copy one NetAddr::IP object to another very quickly.
+
+=item B<C<-E<gt>copy()>>
+
+The B<assignment (C<=>)> operation is only put in to operation when the
+copied object is further mutated by another overloaded operation. See
+L<overload> B<SPECIAL SYMBOLS FOR "use overload"> for details.
+
+B<C<-E<gt>copy()>> actually creates a new object when called.
+
+=item B<Stringification>
+
+An object can be used just as a string. For instance, the following code
+
+ my $ip = new NetAddr::IP '192.168.1.123';
+ print "$ip\n";
+
+Will print the string 192.168.1.123/32.
+
+=item B<Equality>
+
+You can test for equality with either C<eq> or C<==>. C<eq> allows the
+comparison with arbitrary strings as well as NetAddr::IP objects. The
+following example:
+
+ if (NetAddr::IP->new('127.0.0.1','255.0.0.0') eq '127.0.0.1/8')
+ { print "Yes\n"; }
+
+Will print out "Yes".
+
+Comparison with C<==> requires both operands to be NetAddr::IP objects.
+
+In both cases, a true value is returned if the CIDR representation of
+the operands is equal.
+
+=item B<Comparison via E<gt>, E<lt>, E<gt>=, E<lt>=, E<lt>=E<gt> and C<cmp>>
+
+Internally, all network objects are represented in 128 bit format.
+The numeric representation of the network is compared through the
+corresponding operation. Comparisons are tried first on the address portion
+of the object and if that is equal then the NUMERIC cidr portion of the
+masks are compared. This leads to the counterintuitive result that
+
+ /24 > /16
+
+Comparison should not be done on netaddr objects with different CIDR as
+this may produce indeterminate - unexpected results,
+rather the determination of which netblock is larger or smaller should be
+done by comparing
+
+ $ip1->masklen <=> $ip2->masklen
+
+=item B<Addition of a constant (C<+>)>
+
+Add a 32 bit signed constant to the address part of a NetAddr object.
+This operation changes the address part to point so many hosts above the
+current objects start address. For instance, this code:
+
+ print NetAddr::IP::Lite->new('127.0.0.1/8') + 5;
+
+will output 127.0.0.6/8. The address will wrap around at the broadcast
+back to the network address. This code:
+
+ print NetAddr::IP::Lite->new('10.0.0.1/24') + 255;
+
+ outputs 10.0.0.0/24.
+
+Returns the the unchanged object when the constant is missing or out of
+range.
+
+ 2147483647 <= constant >= -2147483648
+
+=item B<Subtraction of a constant (C<->)>
+
+The complement of the addition of a constant.
+
+=item B<Difference (C<->)>
+
+Returns the difference between the address parts of two NetAddr::IP::Lite
+objects address parts as a 32 bit signed number.
+
+Returns B<undef> if the difference is out of range.
+
+(See range restrictions on Addition above)
+
+=item B<Auto-increment>
+
+Auto-incrementing a NetAddr::IP object causes the address part to be
+adjusted to the next host address within the subnet. It will wrap at