Changeset 559 for trunk/cgi-bin


Ignore:
Timestamp:
12/19/12 15:27:02 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Work in progress, see #5:
Fix subtle ordering bug in deleteBlock() handling legacy netblocks
allocated from a static IP pool; the whole point of the special
handling is to NOT make the IPs in it available for general
allocation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r558 r559  
    11191119#  'Net don't work like that, homey.  Restrict VRF-uniqueness to private IPs?
    11201120# -> $isprivnet flag from start of sub
    1121 
    1122       # if the block to be deleted is a container, move its freeblock(s) up a level, and reset their parenting info
    1123       if ($binfo->{type} =~ /^.[mc]/) {
    1124         # move the freeblocks into the parent
    1125         # we don't insert a new freeblock because there could be a live reparented sub.
    1126         $dbh->do("UPDATE freeblocks SET rdepth=rdepth-1,parent=?,routed=?,city=? ".
    1127                 "WHERE parent=? AND rdepth=?", undef,
    1128                 ($parent, $ptype, $pcity, $cidr, $rdepth+1) );
    1129       } else {
    1130         # ... otherwise, add the freeblock
    1131         $dbh->do("INSERT INTO freeblocks (cidr, city, routed, parent, rdepth) VALUES (?,?,?,?,?)", undef,
    1132                 ($cidr, $pcity, $ptype, $parent, $rdepth) );
    1133       }
    11341121
    11351122      my $fbrdepth = $rdepth;
     
    11961183        # freeblocks in the identified parent to see if we can combine any of them.
    11971184
     1185        # if the block to be deleted is a container, move its freeblock(s) up a level, and reset their parenting info
     1186        if ($binfo->{type} =~ /^.[mc]/) {
     1187          # move the freeblocks into the parent
     1188          # we don't insert a new freeblock because there could be a live reparented sub.
     1189          $dbh->do("UPDATE freeblocks SET rdepth=rdepth-1,parent=?,routed=?,city=? ".
     1190                "WHERE parent=? AND rdepth=?", undef,
     1191                ($parent, $ptype, $pcity, $cidr, $rdepth+1) );
     1192        } else {
     1193          # ... otherwise, add the freeblock
     1194          $dbh->do("INSERT INTO freeblocks (cidr, city, routed, parent, rdepth) VALUES (?,?,?,?,?)", undef,
     1195                ($cidr, $pcity, $ptype, $parent, $rdepth) );
     1196        }
     1197
    11981198##fixme: vrf
    11991199        # set up the query to get the list of blocks to try to merge.
Note: See TracChangeset for help on using the changeset viewer.