Subject: | IPv6 Address Creation Broken for Low Address Values |
Date: | Wed, 04 Apr 2012 08:33:29 +0200 |
To: | bug-NetAddr-IP [...] rt.cpan.org |
From: | Fabian Hugelshofer <fh [...] open.ch> |
When creating IPv6 addresses with new6() and an integer as address
value, the address is not created as expected:
$ perl -e 'use NetAddr::IP::Lite; my $addr = NetAddr::IP::Lite->new6(0,
0); print $addr."\n";'
0:0:0:0:0:0:0:0/96
=> Expected would be ::/0
$ perl -e 'use NetAddr::IP::Lite; my $addr = NetAddr::IP::Lite->new6(1
,0); print $addr."\n";'
0:0:0:0:0:0:100:0/96
=> Expected would be ::1/0
$ perl -e 'use NetAddr::IP::Lite; my $addr = NetAddr::IP::Lite->new6(1
,1); print $addr."\n";'
0:0:0:0:0:0:100:0/97
=> Expected would be ::1/1
It looks like integers 0-255 are interpreted as the highest byte of an
IPv4 address which is then represented as an IPv4-compatible IPv6 addresses.
This has been tested with NetAddr-IP-0.059 and Perl v5.14.0.
Kind regards,
Fabian