From d6e50f92aa06dda460e5f8541068c287a88d423f Mon Sep 17 00:00:00 2001 From: sjing Date: Wed, 13 Apr 2011 02:55:22 +0000 Subject: [PATCH] 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 --- xCAT-server/lib/xcat/plugins/ddns.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index af6d56dad..0f8aaeddc 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -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;