Skip Menu |

This queue is for tickets about the Net-Netmask CPAN distribution.

Report information
The Basics
Id: 22084
Status: rejected
Worked: 5 min
Priority: 0/
Queue: Net-Netmask

People
Owner: MUIR [...] cpan.org
Requestors: grjones [...] cpan.org
Cc:
AdminCc:

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



Subject: cidrs2inverse() not returning adjacent ranges
cidrs2inverse fails to return adjacent ranges sometimes. The issue might only occur when it involves a /32 range. See the example below: my $obj1 = new2 Net::Netmask ('1.0.0.3/32'); my $obj2 = new2 Net::Netmask ('1.0.0.4/31'); die Net::Netmask::errstr if Net::Netmask::errstr; my @leftover_ranges = cidrs2inverse($obj1, $obj2); print $leftover_ranges[0] || "Bug: Should have printed 1.0.0.3/32";
The first argument to cidrs2inverse is a block. The remaining arguments are blocks that are to be subtracted from the first block. The return value is what's left. You can't subtract anything from a /32 and expect to have anything left.
From: grjones [...] gmail.com
On Fri Oct 13 22:57:59 2006, MUIR wrote: Show quoted text
> The first argument to cidrs2inverse is a block. The remaining arguments > are blocks that are to be subtracted from the first block. The return > value is what's left. > > You can't subtract anything from a /32 and expect to have anything left.
But these are mutually exclusive ranges. I would expect to still have 1.0.0.3/32 if I am attempting to remove 1.0.0.4/31 (i.e. 1.0.0.[4-5]). Looking at this some more I see that they don't have to be adjacent. It seems that if the first argument is a /32 and the second is any mutually exclusive range, the /32 is not returned. If I try a larger range for the first argument, even a /31, it works as expected. Thank you for your quick response and time. This module has benefited me a great deal.