Changeset 187 for trunk/cgi-bin/IPDB.pm
- Timestamp:
- 03/04/05 18:12:54 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r186 r187 234 234 eval { 235 235 $msg = "Unable to allocate $cidr as '$disp_alloctypes{$type}'"; 236 if ($type eq 'r r') {236 if ($type eq 'rm') { 237 237 $sth = $dbh->prepare("update freeblocks set routed='y',city='$city'". 238 238 " where cidr='$cidr'"); … … 244 244 # common stuff for end-use, dialup, dynDSL, pools, etc, etc. 245 245 246 # special case - block is a container/"reserve" block - alloctype begins with 'r'247 if ($type =~ /^ r.$/) {248 $sth = $dbh->prepare("update freeblocks set routed=' r' where cidr='$cidr'");246 # special case - block is a container/"reserve" block 247 if ($type =~ /^(.)c$/) { 248 $sth = $dbh->prepare("update freeblocks set routed='$1' where cidr='$cidr'"); 249 249 $sth->execute; 250 250 } else { … … 312 312 313 313 # now we have to do some magic for routing blocks 314 if ($type eq 'r r') {314 if ($type eq 'rm') { 315 315 316 316 # Insert the new freeblocks entries … … 336 336 # Insert the new freeblocks entries 337 337 # Along with some more HairyPerl(TM) in case we're inserting a 338 # subblock ( l.) allocation338 # subblock (.r) allocation 339 339 $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)". 340 340 " values (?, ?, (select city from routed where cidr >>= '$cidr'),'". 341 (($type =~ /^ l.$/) ? 'r' : 'y')."')");341 (($type =~ /^(.)r$/) ? '$1' : 'y')."')"); 342 342 foreach my $block (@newfreeblocks) { 343 343 $sth->execute("$block", $block->masklen); 344 344 } 345 # special-case for reserve/"container" blocks 346 if ($type =~ /^r.$/) { 345 # Special-case for reserve/"container" blocks - generate 346 # the "extra" freeblocks entry for the container 347 if ($type =~ /^(.)c$/) { 347 348 $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)". 348 " values ('$cidr',".$cidr->masklen.",'$city',' r')");349 " values ('$cidr',".$cidr->masklen.",'$city','$1')"); 349 350 $sth->execute; 350 351 } … … 500 501 eval { 501 502 502 if ($type eq 'r r') {503 if ($type eq 'rm') { 503 504 $msg = "Unable to remove routing allocation $cidr"; 504 505 $sth = $dbh->prepare("delete from routed where cidr='$cidr'"); … … 531 532 "(select cidr from routed where cidr >>= '$cidr') ". 532 533 " and maskbits<=".$cidr->masklen. 533 " and routed='".(($type =~ /^ l.$/) ? 'r' : 'y').534 " and routed='".(($type =~ /^(.)r$/) ? '$1' : 'y'). 534 535 "' order by maskbits desc"); 535 536 … … 569 570 570 571 # insert "new" freeblocks entry 571 if ($type eq 'r r') {572 if ($type eq 'rm') { 572 573 $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city)". 573 574 " values ('$cidr',".$cidr->masklen.",'<NULL>')"); … … 576 577 " values ('$cidr',".$cidr->masklen. 577 578 ",(select city from routed where cidr >>= '$cidr'),'". 578 (($type =~ /^ l.$/) ? 'r' : 'y')."')");579 (($type =~ /^(.)r$/) ? '$1' : 'y')."')"); 579 580 } 580 581 $sth->execute;
Note:
See TracChangeset
for help on using the changeset viewer.