kept the original logic for classless networks bigger than /24(multiple zones).

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9290 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
sjing 2011-04-13 02:55:22 +00:00
parent 990d9ada0b
commit d6e50f92aa

View File

@ -132,8 +132,14 @@ sub get_reverse_zones_for_entity {
if ($net =~ /\./) { #IPv4/IN-ADDR.ARPA case.
my $maskstr = unpack("B32",pack("N",$ctx->{nets}->{$net}->{mask}));
my $maskcount = ($maskstr =~ tr/1//);
$maskcount-=($maskcount%8); #e.g. treat the 27bit netmask as 24bit
#$maskcount+=((8-($maskcount%8))%8); #round to the next octet
if ($maskcount >= 24)
{
$maskcount-=($maskcount%8); #e.g. treat the 27bit netmask as 24bit
}
else
{
$maskcount+=((8-($maskcount%8))%8); #round to the next octet
}
my $newmask = 2**$maskcount -1 << (32 - $maskcount);
my $rev = inet_ntoa(pack("N",($tvar & $newmask)));
my @zone;