Skip Menu |

This queue is for tickets about the NetAddr-IP CPAN distribution.

Report information
The Basics
Id: 84234
Status: rejected
Priority: 0/
Queue: NetAddr-IP

People
Owner: Nobody in particular
Requestors: brad [...] magic7s.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: split does not allocate correctly
Date: Tue, 26 Mar 2013 23:22:10 -0700
To: bug-NetAddr-IP [...] rt.cpan.org
From: Brad Downey <brad [...] magic7s.com>
#!/usr/bin/perl use NetAddr::IP; $test = new NetAddr::IP("192.168.0.0/21"); @cidrs = $test->split(23,24,25,27,28,28,24); print join("\n",@cidrs); Show quoted text
---- Output ----- 192.168.0.0/23 192.168.2.0/24 192.168.3.0/25 192.168.3.128/27 192.168.3.160/28 192.168.3.176/28 ! It breaks here. This is not the next subnet for a /24 192.168.3.192/24 192.168.4.192/24 192.168.5.192/24 192.168.6.192/24 ! The last network should be 192.168.7.0/24 192.168.7.192/27 192.168.7.224/27 -------------------- Brads-MacBook-Air-2:scripts brad$ perl -v This is perl 5, version 12, subversion 4 (v5.12.4) built for darwin-thread-multi-2level (with 2 registered patches, see perl -V for more detail) Copyright 1987-2010, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. Brads-MacBook-Air-2:scripts brad$uname -a Darwin Brads-MacBook-Air-2.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
NetAddr::IP split does not support splitting partially filled IP allocations. The example you show splits correctly based on the parameters supplied. We can see the usefulness of what you require so it would/could make a good addition to the functionality of NetAddr::IP. Please submit new function requirement and proposed tests and we'll take a look at it. Michael (for Luis too) On Wed Mar 27 02:22:22 2013, brad@magic7s.com wrote: Show quoted text
> #!/usr/bin/perl > use NetAddr::IP; > $test = new NetAddr::IP("192.168.0.0/21"); > @cidrs = $test->split(23,24,25,27,28,28,24); > print join("\n",@cidrs); > > ---- Output ----- > > 192.168.0.0/23 > 192.168.2.0/24 > 192.168.3.0/25 > 192.168.3.128/27 > 192.168.3.160/28 > 192.168.3.176/28 > ! It breaks here. This is not the next subnet for a /24 > 192.168.3.192/24 > 192.168.4.192/24 > 192.168.5.192/24 > 192.168.6.192/24 > ! The last network should be 192.168.7.0/24 > 192.168.7.192/27 > 192.168.7.224/27 > > > -------------------- > Brads-MacBook-Air-2:scripts brad$ perl -v > > This is perl 5, version 12, subversion 4 (v5.12.4) built for > darwin-thread-multi-2level > (with 2 registered patches, see perl -V for more detail) > > Copyright 1987-2010, Larry Wall > > Perl may be copied only under the terms of either the Artistic License or > the > GNU General Public License, which may be found in the Perl 5 source kit. > > Complete documentation for Perl, including FAQ lists, should be found on > this system using "man perl" or "perldoc perl". If you have access to the > Internet, point your browser at http://www.perl.org/, the Perl Home Page. > > Brads-MacBook-Air-2:scripts brad$uname -a > Darwin Brads-MacBook-Air-2.local 12.3.0 Darwin Kernel Version 12.3.0: Sun > Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64