Subject: | ip_reverse IPv6 bug |
Date: | Mon, 22 Mar 2010 22:18:12 -0400 |
To: | bug-net-ip [...] rt.cpan.org |
From: | Dan Pritts <danno [...] internet2.edu> |
Hi,
the procedural ip_reverse call fails with ipv6 addresses with shorthand :: for
missing 0's.
The OO reverse_ip method works.
~@ns0% cat rev2.pl
#!/usr/bin/perl
#use Net::IP;
use Net::IP qw(:PROC);
$v6addr='2001:468:1420::151';
my $ip = new Net::IP ($v6addr) or die (Net::IP::Error());
print ("OO Rev: ".$ip->reverse_ip()."\n");
my $revaddr=ip_reverse($v6addr);
print ("Procedural Rev: ".$revaddr."\n");
~@ns0% perl rev
rev2.pl revip6.pl
~@ns0% perl rev2.pl
OO Rev: 1.5.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.4.1.8.6.4.0.1.0.0.2.ip6.arpa.
Procedural Rev: 1.5.1.0.2.4.1.8.6.4.1.0.0.2.ip6.arpa.
~@ns0% perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=linux, osvers=2.6.18-128.1.10.el5, archname=x86_64-linux-thread-multi
uname='linux ls20-bc2-13.build.redhat.com 2.6.18-128.1.10.el5 #1 smp wed apr 29 13:53:08 edt 2009 x86_64 x86_64 x86_64 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dprivlib=/usr/lib/perl5/5.8.8 -Dsitelib=/usr/lib/perl5/site_perl/5.8.8 -Dvendorlib=/usr/lib/perl5/vendor_perl/5.8.8 -Darchlib=/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi -Dsitearch=/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi -Dvendorarch=/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi -Darchname=x86_64-linux-thread-multi -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=define uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-44)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =''
libpth=/usr/local/lib64 /lib64 /usr/lib64
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT
USE_ITHREADS USE_LARGE_FILES USE_PERLIO
USE_REENTRANT_API
Built under linux
Compiled at Jul 2 2009 05:49:38
@INC:
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi
/usr/lib/perl5/5.8.8
.
~@ns0% rpm -qi perl
Name : perl Relocations: (not relocatable)
Version : 5.8.8 Vendor: Red Hat, Inc.
Release : 27.el5 Build Date: Thu 02 Jul 2009 05:58:25 AM EDT
Install Date: Wed 09 Dec 2009 11:57:53 AM EST Build Host: ls20-bc2-13.build.redhat.com
Group : Development/Languages Source RPM: perl-5.8.8-27.el5.src.rpm
Size : 35292014 License: Artistic or GPL
Signature : DSA/SHA1, Mon 13 Jul 2009 10:16:08 AM EDT, Key ID 5326810137017186
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://www.perl.org/
Summary : The Perl programming language
Description :
Perl is a high-level programming language with roots in C, sed, awk
and shell scripting. Perl is good at handling processes and files,
and is especially good at handling text. Perl's hallmarks are
practicality and efficiency. While it is used to do a lot of
different things, Perl's most common applications are system
administration utilities and web programming. A large proportion of
the CGI scripts on the web are written in Perl. You need the perl
package installed on your system so that your system can handle Perl
scripts.
Install this package if you want to program in Perl or enable your
system to handle Perl scripts.
~@ns0% rpm -qi perl-Net-IP
Name : perl-Net-IP Relocations: (not relocatable)
Version : 1.25 Vendor: Red Hat, Inc.
Release : 2.fc6 Build Date: Wed 05 Jul 2006 03:37:16 PM EDT
Install Date: Fri 10 Aug 2007 05:55:27 AM EDT Build Host: devel8.z900.redhat.com
Group : Development/Libraries Source RPM: perl-Net-IP-1.25-2.fc6.src.rpm
Size : 82547 License: GPL or Artistic
Signature : DSA/SHA1, Thu 18 Jan 2007 11:13:33 AM EST, Key ID 5326810137017186
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://search.cpan.org/dist/Net-IP/
Summary : Perl module for manipulation of IPv4 and IPv6 addresses
Description :
This is the Net::IP module for Perl, designed to allow easy
manipulation of IPv4 and IPv6 addresses. Two applications using the
Net::IP module are included: ipcount, an IP address mini-calculator,
it can calculate the number of IP addresses in a prefix or all the
prefixes contained in a given range; and iptab, which prints out a
handy IP "cheat sheet".
danno
--
Dan Pritts, Sr. Systems Engineer
Internet2
office: +1-734-352-4953 | mobile: +1-734-834-7224
Internet2 Spring Member Meeting
April 26-28, 2010 - Arlington, Virginia
http://events.internet2.edu/2010/spring-mm/