Masks are already being handled properly by the other method. Wouldn't it be 
better to just skip CIDR processing entirely when we detect a mask?

Matt


On Nov 15, 2012, at 4:43 AM, Michael Holzt <k...@fqdn.org> wrote:

>> It will return for the given example '2001:db8:123/44' which as I
>> understands is the correct meaning of '2001:db8:123' when we split
>> at nibble endings.
> 
> Oh, well, it isn't. It should be expanded to 2001:db8:1230::/24.
> 
> Add the four marked lines:
> 
>  # Get the length of the last segment
>  my $lastseglen = length( (split(/:/,$ip))[$cntcolons] );
> 
> +  # Attach trailing zeros to last segment if needed
> +  $ip .= '0' x ( 4-$lastseglen );
> 
> +  # Attach :: at the end if address is less than 8 blocks
> +  $ip .= '::' if ( $cntcolons < 7 );
> 
>  # And now calculate the number of significant bits and append
>  $ip .= '/' . ( $cntcolons*16 + $lastseglen*4 );
> 
> 
> 
> Regards,
> Michael
> 
> -- 
> It's an insane world, but i'm proud to be a part of it. -- Bill Hicks

Reply via email to