Bug#838274: libnetaddr-ip-perl: Parses number - version() == 4 - prints v6

2016-09-20 Thread Niko Tyni
Control: forwarded -1 https://rt.cpan.org/Public/Bug/Display.html?id=117995

On Mon, Sep 19, 2016 at 12:34:19PM +0200, Florian Lohoff wrote:
> 
> Package: libnetaddr-ip-perl
> Version: 4.075+dfsg-1+b1
> 
> Hi,
> suddenly some DNS zones of ours went belly up because a user
> succeeded in entering a pure number. It got parsed from NetAddr::IP
> which said by ->version() it to be a v4 address but printing it 
> returned a v6 address:
> 
> $ perl -MNetAddr::IP -e '$a=new NetAddr::IP('992018'); print 
> $a->version(). "\n"; print $a . "\n"'
> 4
> 0:0:0:0:0:2:1872:8172/128
> 
> This is pretty unexpected. I would have thought that parsing would
> return an "undef".

Thanks for the report.

Integer representation of IP addresses is quite well defined, just try
'ping 134744072'.

The primary bug here seems to be that when the integer is bigger than
the range of IPv4 addresses (2^32-1), the address gets treated as an
IPv6 one but the version field doesn't reflect that.

I've forwarded this upstream at
 https://rt.cpan.org/Public/Bug/Display.html?id=117995

-- 
Niko TYni   nt...@debian.org



Bug#838274: libnetaddr-ip-perl: Parses number - version() == 4 - prints v6

2016-09-19 Thread Florian Lohoff

Package: libnetaddr-ip-perl
Version: 4.075+dfsg-1+b1

Hi,
suddenly some DNS zones of ours went belly up because a user
succeeded in entering a pure number. It got parsed from NetAddr::IP
which said by ->version() it to be a v4 address but printing it 
returned a v6 address:

$ perl -MNetAddr::IP -e '$a=new NetAddr::IP('992018'); print $a->version(). 
"\n"; print $a . "\n"'
4
0:0:0:0:0:2:1872:8172/128

This is pretty unexpected. I would have thought that parsing would
return an "undef".

Flo
-- 
Florian Lohoff f...@zz.de
 UTF-8 Test: The  ran after a , but the  ran away


signature.asc
Description: Digital signature