Commit 5417a356 authored by Kirk Webb's avatar Kirk Webb

Avoid '255' in any part of the allocated address.

parent 40b069ca
......@@ -269,7 +269,7 @@ sub _findFree($$$) {
}
# Not at the terminal depth yet, so keep walking down (keeping
# left), creating nodes as necessary.
# right), creating nodes as necessary.
if (!$cn->hasRight()) {
$cn->setRight(Tree::Binary->new({"value" => 1,
"term" => 0}));
......
......@@ -217,6 +217,7 @@ sub requestAddressRange($$$) {
my $bud = $self->_getbuddy();
# IPBuddyAlloc throws exceptions.
again:
my $base = eval { $bud->requestAddressRange($prefix) };
if ($@) {
tberror("Error while requesting address range: $@");
......@@ -226,6 +227,14 @@ sub requestAddressRange($$$) {
tberror("Could not get a free address range!\n");
return undef;
}
# Throw away any ranges where all the bits are set in the quad.
# We want to avoid confusion and potential issues with broadcast
# addresses.
foreach my $quad (split(/\./, $base)) {
if ($quad == 255) {
goto again;
}
}
my $range = "$base/$prefix";
# Push the new range onto the new range list. This also puts it
# into the "allocated" hash.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment