On Thu, 20 Nov 2008, kashmish via RT wrote:
Show quoted text> Queue: NetAddr-IP
> Ticket <URL:
http://rt.cpan.org/Ticket/Display.html?id=41008 >
>
> michael,
> that sounds good! thx for looking into it.
>
> one further thought fudder:
>
> rather then splitting a cidr into same sized subnets,
> i personally prefer them as an aggregated list.
> e.g.:
> x/48 id given, but i need a /50 out of.
> instead of splitting the /48 into 8 x /50,
> i usually need that highest possible aggregates as:
> 2 x /50 +
> 1 x /49
> so, the returning number of items is only 3 lines instead of 8,
> similar if youd split a /32 into /128's,
> instead of manymanymany 128's, (memory probs etc.)
> i would rather need get 'only' 96 (or 97?) lines back...
> much easier to handle!
>
hmmm.... how about something like this where the current split($bits) is
extended
With a single argument, split works as stated. An extend version could
work like this where the "split" would do the arguments as encountered and
replicate the last argument.
i.e.
where $ip = someipV6/48
$ip->split(50,50,49)
split would return two 50's and the balance in /49's
further, negating any argument to split would cause it to work from the
top down instead of the bottom up. i.e it would return a bunch of 49's
and two 50's. Similarly, mask IP's could be used but the "reversal"
feature would not be available in this context.
That might be a reasonable extension. I don't have any idea at the moment
what kind of coding would be required to extend this feature. Am pretty
busy now but will look into it maybe later.
Michael
Show quoted text> so, i wrote a little tool like:
> --------------
> use NetAddr::IP;
> my $ip = new NetAddr::IP $ARGV[0];
> my $ipver = $ip->version();
> my $supermask=$ip->masklen();
> my $mask=$ARGV[1];
> my $oursuper=$ip;
> for ($i = $supermask + 1; $i <= $mask; $i++) {
> my $calcip = new NetAddr::IP $oursuper;
> my @CURRENTHALFS;
> if ($ipver == 4) {
> @CURRENTHALFS = $calcip->split($i);
> print "$CURRENTHALFS[1]\n";
> $oursuper=$CURRENTHALFS[0];
> } else {
> my $v6halfstr = `ipv6gen $calcip $i`;
> @CURRENTHALFS = split("\n", "$v6halfstr");
> print "$CURRENTHALFS[1]\n";
> $oursuper=$CURRENTHALFS[0];
> }
> }
> print "$oursuper\n";
> --------------------------------------
> maybe an easy to implement feature to integrate?
> eg as:
> splitaggr(l)
> or
> splitaggr(b)
>
> with l=little endian and b=bigendian,
> so the destination split might be at the beginning or the end of the
> superblock?
>
> makes sense?
> you care?
>
> cheers anyways
> ;-)
> -k
>
>
>
> michael@insulin-pumpers.org via RT wrote:
> > <URL:
http://rt.cpan.org/Ticket/Display.html?id=41008 >
> >
> >
> >
> > No, nets containing IP's of more than 2 **32 are not allowed because
> > it would be too large an array to process and return.
> >
> > I see the dilemma here. I will take a look at the implementation and
> > see if it warrants a change. Perhaps what we need to do is restrict
> > the return size of the array instead of the number of nets.
> >
> > Michael
> >
> >
> >> Michael Robinton via RT wrote:
> >>
> >
> >
> >
> >
> >
>
>