Changeset 11 for trunk/cgi-bin
- Timestamp:
- 10/25/04 17:28:12 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/consistency-check.pl
r8 r11 82 82 foreach $master (@masterblocks) { 83 83 print "Master $master:\n"; 84 ($next,undef) = split /\//, $master; 85 ($last,undef) = split /\//, ($master->broadcast); 84 $prev = $master; 86 85 $sth = $dbh->prepare("(select network(cidr) as net, broadcast(cidr) as bcast ". 87 86 " from allocations where cidr <<= '$master') union ". … … 89 88 "from freeblocks where cidr <<= '$master') order by net"); 90 89 $sth->execute; 90 91 91 while (@data = $sth->fetchrow_array) { 92 ($cur,undef) = split /\//, $data[0]; 93 if ($master !~ /$next/) { 94 ($tmp,undef) = split /\//, $next; 95 @tmp1 = split /\./, $tmp; 96 $tmp1[3]++; 97 if ($tmp1[3] == 256) { $tmp1[3] = 0; $tmp1[2]++; } 98 $cmp = join '.', @tmp1; 92 $cur = new NetAddr::IP $data[0]; 93 94 if ($master->numeric == $prev->numeric) { 95 # check if cur starts with master 96 if ($cur->numeric > $prev->numeric) { 97 print " Gap from start of master $master to first block $cur\n"; 98 } elsif ($cur->numeric < $prev->numeric) { 99 print " BIG problem! Current block $cur begins before master $master!\n"; 100 } 99 101 } else { 100 $cmp = $next; 102 if ($cur->numeric < ($prev->numeric + 1)) { 103 print " Block ".$prev->network." overlaps block $cur\n"; 104 } elsif ($cur->numeric > ($prev->numeric + 1)) { 105 print " Gap between end of block ".$prev->network." and block $cur\n"; 106 } 101 107 } 102 if ($cur ne $cmp) { 103 print " Gap from $next to $cur\n"; 104 } 105 ($next,undef) = split /\//, $data[1]; 106 } 107 if ($next ne $last) { 108 print " Gap from $next to end of master at $last\n"; 108 109 $prev = $cur; 110 $prev--; 111 112 } # while (@data...) 113 114 $cur--; 115 $master--; 116 if ($cur->numeric ne $master->numeric) { 117 print " Gap from $cur to end of master at $master\n"; 109 118 } 110 119 print "done $master.\n";
Note:
See TracChangeset
for help on using the changeset viewer.