Subject: | Net-IP -- ip++ return NULL on some funcions |
Date: | Fri, 09 Jan 2015 17:52:53 -0200 |
To: | bug-Net-IP [...] rt.cpan.org |
From: | Guilherme Eliseu Rhoden <rhoden [...] pop-sc.rnp.br> |
Hi all,
Some object methods like reverse_ip, prefixlen and mask are not working
correctly on next address (++) in the object. They are returning
sometimes a NULL value (See Script Output below).
--- ---
uname -a
Linux rancid 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linu
perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for
x86_64-linux-gnu-thread-multi
..
dpkg -l | grep libnet-ip-perl
ii libnet-ip-perl 1.25-3
all Perl extension for manipulating IPv4/IPv6 addresses
..
Show quoted text
---- TEST SCRIPT ---
cat bug_reverso.pl
use Net::IP;
print "IPv4\n";
my $ip = new Net::IP ('192.168.1.0/30') || die;
# Loop
do {
print ("IP : ".$ip->ip()."\n");
print ("Sho : ".$ip->short()."\n");
print ("Bin : ".$ip->binip()."\n");
print ("Int : ".$ip->intip()."\n");
print ("Mask: ".$ip->mask()."\n");
print ("Last: ".$ip->last_ip()."\n");
print ("Len : ".$ip->prefixlen()."\n");
print ("Size: ".$ip->size()."\n");
print ("Type: ".$ip->iptype()."\n");
print ("Rev: ".$ip->reverse_ip()."\n\n");
} while (++$ip);
print "IPv6\n";
my $ip = new Net::IP ('2001:12f0:200:bbb::/126') || die;
# Loop
do {
print ("IP : ".$ip->ip()."\n");
print ("Sho : ".$ip->short()."\n");
print ("Bin : ".$ip->binip()."\n");
print ("Int : ".$ip->intip()."\n");
print ("Mask: ".$ip->mask()."\n");
print ("Last: ".$ip->last_ip()."\n");
print ("Len : ".$ip->prefixlen()."\n");
print ("Size: ".$ip->size()."\n");
print ("Type: ".$ip->iptype()."\n");
print ("Rev: ".$ip->reverse_ip()."\n\n");
} while (++$ip);
---- OUTPUT ---
perl bug_reverso.pl
IPv4
IP : 192.168.1.0
Sho : 192.168.1.0
Bin : 11000000101010000000000100000000
Int : 3232235776
Mask: 255.255.255.252
Last: 192.168.1.3
Len : 30
Size: 4
Type: PRIVATE
Rev: 1.168.192.in-addr.arpa.
IP : 192.168.1.1
Sho : 192
Bin : 11000000101010000000000100000001
Int : 3232235777
Mask:
Last: 192.168.1.3
Len :
Size: 3
Type: PRIVATE
Rev:
IP : 192.168.1.2
Sho : 192.168.1.2
Bin : 11000000101010000000000100000010
Int : 3232235778
Mask: 255.255.255.254
Last: 192.168.1.3
Len : 31
Size: 2
Type: PRIVATE
Rev: 2.1.168.192.in-addr.arpa.
IP : 192.168.1.3
Sho : 192.168.1.3
Bin : 11000000101010000000000100000011
Int : 3232235779
Mask: 255.255.255.255
Last: 192.168.1.3
Len : 32
Size: 1
Type: PRIVATE
Rev: 3.1.168.192.in-addr.arpa.
IPv6
IP : 2001:12f0:0200:0bbb:0000:0000:0000:0000
Sho : 2001:12f0:200:bbb::
Bin :
00100000000000010001001011110000000000100000000000001011101110110000000000000000000000000000000000000000000000000000000000000000
Int : 42540872260726737329274153413604540416
Mask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffc
Last: 2001:12f0:0200:0bbb:0000:0000:0000:0003
Len : 126
Size: 4
Type: GLOBAL-UNICAST
Rev:
0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.b.b.b.0.0.0.2.0.0.f.2.1.1.0.0.2.ip6.arpa.
IP : 2001:12f0:0200:0bbb:0000:0000:0000:0001
Sho : 2001:12f0:200:bbb::1
Bin :
00100000000000010001001011110000000000100000000000001011101110110000000000000000000000000000000000000000000000000000000000000001
Int : 42540872260726737329274153413604540417
Mask:
Last: 2001:12f0:0200:0bbb:0000:0000:0000:0003
Len :
Size: 3
Type: GLOBAL-UNICAST
Rev:
IP : 2001:12f0:0200:0bbb:0000:0000:0000:0002
Sho : 2001:12f0:200:bbb::2
Bin :
00100000000000010001001011110000000000100000000000001011101110110000000000000000000000000000000000000000000000000000000000000010
Int : 42540872260726737329274153413604540418
Mask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:fffe
Last: 2001:12f0:0200:0bbb:0000:0000:0000:0003
Len : 127
Size: 2
Type: GLOBAL-UNICAST
Rev:
0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.b.b.b.0.0.0.2.0.0.f.2.1.1.0.0.2.ip6.arpa.
IP : 2001:12f0:0200:0bbb:0000:0000:0000:0003
Sho : 2001:12f0:200:bbb::3
Bin :
00100000000000010001001011110000000000100000000000001011101110110000000000000000000000000000000000000000000000000000000000000011
Int : 42540872260726737329274153413604540419
Mask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
Last: 2001:12f0:0200:0bbb:0000:0000:0000:0003
Len : 128
Size: 1
Type: GLOBAL-UNICAST
Rev:
3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.b.b.b.0.0.0.2.0.0.f.2.1.1.0.0.2.ip6.arpa.
--
Sds, Guilherme
*Guilherme Rhoden*
Coordenador Técnico
*PoP-SC* - Ponto de Presença da RNP em Santa Catarina
*REMEP-FLN* - Rede Metropolitana de Educação e Pesquisa da Região de
Florianópolis
*RNP* - Rede Nacional de Ensino e Pesquisa
*UFSC* - Universidade Federal de Santa Catarina
*SETIC* - Superintendência de Governança Eletrônica e Tecnologia da
Informação e Comunicação
Fundações de Apoio FEESC e FEPESE
--/--
www.pop-sc.rnp.br
remep.pop-sc.rnp.br
CHAMADOS: noc@pop-sc.rnp .br
+55(48)3721-6335
INOC: 11242*100
PGP PubKey: http://www.pop-sc.rnp.br/ac/rhoden-pop-sc.pgp