Changeset 556 for trunk/cgi-bin
- Timestamp:
- 12/18/12 17:57:27 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r555 r556 233 233 # elsewhere though; legacy data may have traps and pitfalls in it to break this. 234 234 # Thus the "routed" flag. 235 $dbh->do("INSERT INTO freeblocks (cidr,maskbits,city,routed ) VALUES (?,?,?,?)", undef,236 ($cidr, $cidr->masklen, '<NULL>', ' n') );235 $dbh->do("INSERT INTO freeblocks (cidr,maskbits,city,routed,parent,rdepth) VALUES (?,?,?,?,?,?)", undef, 236 ($cidr, $cidr->masklen, '<NULL>', 'm', $cidr, 1) ); 237 237 238 238 # If we get here, everything is happy. Commit changes. … … 264 264 265 265 # collect the unrouted free blocks within the new master 266 $sth = $dbh->prepare("SELECT cidr FROM freeblocks WHERE mask bits <= ? AND cidr <<= ? AND routed = 'n'");266 $sth = $dbh->prepare("SELECT cidr FROM freeblocks WHERE masklen(cidr) <= ? AND cidr <<= ? AND routed = 'm'"); 267 267 $sth->execute($smallmask, $cidr); 268 268 while (my @data = $sth->fetchrow_array) { … … 278 278 # freeblocks 279 279 $sth = $dbh->prepare("DELETE FROM freeblocks WHERE cidr <<= ?"); 280 my $sth2 = $dbh->prepare("INSERT INTO freeblocks (cidr,maskbits,city,routed) VALUES (?,?,'<NULL>','n')"); 280 my $sth2 = $dbh->prepare("INSERT INTO freeblocks (cidr,maskbits,city,routed,parent,rdepth)". 281 " VALUES (?,?,'<NULL>','m',?,1)"); 281 282 foreach my $newblock (@blocklist) { 282 283 $sth->execute($newblock); 283 $sth2->execute($newblock, $newblock->masklen); 284 } 284 $sth2->execute($newblock, $newblock->masklen, $cidr); 285 } 286 287 # update parent relations at rdepth=1 288 $dbh->do("UPDATE allocations SET parent = ? WHERE parent << ? AND rdepth=1", undef, ($cidr, $cidr) ); 289 $dbh->do("UPDATE freeblocks SET parent = ? WHERE parent << ? AND rdepth=1", undef, ($cidr, $cidr) ); 285 290 286 291 # master
Note:
See TracChangeset
for help on using the changeset viewer.