Subject: | NetAddr::IP->new6 ignores the mask |
I am trying to construct a NetAddr::IP object given the numeric
representation of the address (ex: 12345) and the prefix (ex: 1).
The IPv4 version of new works fine:
NetAddr::IP->new(12345, 1) => 0.0.48.57/1
But the IPv6 version ignores the mask specified and uses 128 instead:
NetAddr::IP->new6(12345, 1) => 0:0:0:0:0:0:0:3039/128
At first I tried to work around this by including the mask in the first
parameter to new6, but this doesn't seem to work (I can't tell if this
is a bug or an undocumented feature :)
NetAddr::IP->new6("12345/1") => 0:0:0:0:0:0:0:3039/97
The only workaround I found is:
NetAddr::IP->new6(NetAddr::IP->new6(12345)->addr . "/1") =>
0:0:0:0:0:0:0:3039/1