diff --git a/Changes b/Changes index bcd128f..c687d65 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,11 @@ Revision history for Perl extension NetAddr::IP +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 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 diff --git a/IP.pm b/IP.pm index c14df5f..bd358ee 100644 --- a/IP.pm +++ b/IP.pm @@ -34,7 +34,7 @@ @ISA = qw(Exporter NetAddr::IP::Lite); -$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.29 $ =~ /\d+/g) }; +$VERSION = do { sprintf " %d.%03d", (q$Revision: 4.30 $ =~ /\d+/g) }; =pod diff --git a/Lite/Changes b/Lite/Changes index 5598a48..2aa097a 100644 --- a/Lite/Changes +++ b/Lite/Changes @@ -1,5 +1,11 @@ Revision history for Perl extension NetAddr::IP::Lite +1.15 Tue Jul 20 15:32:23 PDT 2010 + Resolve named hosts using gethostbyname, followed by gethostbyname6 + to determine whether to set ipV6 flag + + Thanks to Dusty Mabe for spotting this bug + 1.14 Thu Jul 8 18:17:38 PDT 2010 added support for the sub "new" to resolve host6 names if the OPTIONAL perl Socket6 module is available diff --git a/Lite/Lite.pm b/Lite/Lite.pm index edcf483..f11c9f0 100644 --- a/Lite/Lite.pm +++ b/Lite/Lite.pm @@ -27,7 +27,7 @@ ); use vars qw(@ISA @EXPORT_OK $VERSION $Accept_Binary_IP $Old_nth $AUTOLOAD *Zero); -$VERSION = do { my @r = (q$Revision: 1.14 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +$VERSION = do { my @r = (q$Revision: 1.15 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; require Exporter; @@ -853,10 +853,15 @@ return undef if hasbits($ip & $tmp); last; } +# check for resolvable IPv4 hosts + elsif ($ip !~ /[^a-zA-Z0-9\.-]/ && ($tmp = gethostbyname($ip)) && $tmp ne $_v4zero && $tmp ne $_zero ) { + $ip = ipv4to6($tmp); + last; + } +# check for resolvable IPv6 hosts elsif ($ip !~ /[^a-zA-Z0-9\.-]/ && ($tmp = $_gethostbyname->($ip))) { $ip = $tmp; -# elsif ($ip !~ /[^a-zA-Z0-9\.-]/ && ($tmp = gethostbyname($ip)) && $tmp ne $_v4zero && $tmp ne $_zero ) { -# $ip = ipv4to6($tmp); + $isV6 = 1; last; } elsif ($Accept_Binary_IP && ! $hasmask) { diff --git a/META.yml b/META.yml index 4c46f61..9c65e80 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: NetAddr-IP -version: 4.029 +version: 4.030 abstract: Manages IPv4 and IPv6 addresses and subnets license: ~ author: