Changeset 192 for branches


Ignore:
Timestamp:
03/10/05 14:15:19 (20 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Merge updates and changes (and bugfixes to same) from /trunk
r186,187 and r189-191

Location:
branches/stable
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/IPDB.pm

    r185 r192  
    234234      eval {
    235235        $msg = "Unable to allocate $cidr as '$disp_alloctypes{$type}'";
    236         if ($type eq 'rr') {
     236        if ($type eq 'rm') {
    237237          $sth = $dbh->prepare("update freeblocks set routed='y',city='$city'".
    238238            " where cidr='$cidr'");
     
    243243        } else {
    244244          # common stuff for end-use, dialup, dynDSL, pools, etc, etc.
    245           $sth = $dbh->prepare("delete from freeblocks where cidr='$cidr'");
    246           $sth->execute;
    247 
     245
     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            $sth->execute;
     250          } else {
     251            # "normal" case
     252            $sth = $dbh->prepare("delete from freeblocks where cidr='$cidr'");
     253            $sth->execute;
     254          }
    248255          $sth = $dbh->prepare("insert into allocations".
    249256                " (cidr,custid,type,city,description,notes,maskbits,circuitid)".
     
    305312
    306313        # now we have to do some magic for routing blocks
    307         if ($type eq 'rr') {
     314        if ($type eq 'rm') {
    308315
    309316          # Insert the new freeblocks entries
     
    325332          $sth->execute;
    326333
    327         } else { # done with alloctype == rr
     334        } else { # done with alloctype == rm
    328335
    329336          # Insert the new freeblocks entries
     337          # Along with some more HairyPerl(TM) in case we're inserting a
     338          # subblock (.r) allocation
    330339          $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)".
    331                 " values (?, ?, (select city from routed where cidr >>= '$cidr'),'y')");
     340                " values (?, ?, (select city from routed where cidr >>= '$cidr'),'".
     341                (($type =~ /^(.)r$/) ? "$1" : 'y')."')");
    332342          foreach my $block (@newfreeblocks) {
    333343            $sth->execute("$block", $block->masklen);
    334344          }
    335 
     345          # Special-case for reserve/"container" blocks - generate
     346          # the "extra" freeblocks entry for the container
     347          if ($type =~ /^(.)c$/) {
     348            $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)".
     349                " values ('$cidr',".$cidr->masklen.",'$city','$1')");
     350            $sth->execute;
     351          }
    336352          # Insert the allocations entry
    337353          $sth = $dbh->prepare("insert into allocations (cidr,custid,type,city,".
     
    354370          }
    355371
    356         } # done with netblock alloctype != rr
     372        } # done with netblock alloctype != rm
    357373
    358374        $dbh->commit;
     
    485501    eval {
    486502
    487       if ($type eq 'rr') {
     503      if ($type eq 'rm') {
    488504        $msg = "Unable to remove routing allocation $cidr";
    489505        $sth = $dbh->prepare("delete from routed where cidr='$cidr'");
     
    499515      } else { # end alloctype routing case
    500516
    501         $sth = $dbh->prepare("delete from allocations where cidr='$cidr'");
     517        # Delete all allocations within the block being deleted.  This is
     518        # deliberate and correct, and removes the need to special-case
     519        # removal of "container" blocks.
     520        $sth = $dbh->prepare("delete from allocations where cidr <<='$cidr'");
    502521        $sth->execute;
     522
    503523        # Special case - delete pool IPs
    504524        if ($type =~ /^.[pd]$/) {
     
    511531        $sth = $dbh->prepare("select cidr from freeblocks where cidr <<= ".
    512532                "(select cidr from routed where cidr >>= '$cidr') ".
    513                 " and maskbits<=".$cidr->masklen." and routed='y' order by maskbits desc");
     533                " and maskbits<=".$cidr->masklen.
     534                " and routed='".(($type =~ /^(.)r$/) ? '$1' : 'y').
     535                "' order by maskbits desc");
    514536
    515537      } # end alloctype general case
     
    562584      }
    563585
    564       # Clear old freeblocks entries - if any.  $i==0 if not.
    565       if ($i>0) {
    566         $sth = $dbh->prepare("delete from freeblocks where cidr=?");
    567         foreach my $block (@combinelist) {
    568           $sth->execute("$block");
    569         }
    570       }
     586      # Clear old freeblocks entries - if any.  They should all be within
     587      # the $cidr determined above.
     588      $sth = $dbh->prepare("delete from freeblocks where cidr <<='$cidr'");
     589      $sth->execute;
    571590
    572591      # insert "new" freeblocks entry
    573       if ($type eq 'rr') {
     592      if ($type eq 'rm') {
    574593        $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city)".
    575594                " values ('$cidr',".$cidr->masklen.",'<NULL>')");
     
    577596        $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)".
    578597                " values ('$cidr',".$cidr->masklen.
    579                 ",(select city from routed where cidr >>= '$cidr'),'y')");
     598                ",(select city from routed where cidr >>= '$cidr'),'".
     599                (($type =~ /^(.)r$/) ? "$1" : 'y')."')");
    580600      }
    581601      $sth->execute;
  • branches/stable/cgi-bin/consistency-check.pl

    r168 r192  
    1717initIPDBGlobals($dbh);
    1818
    19 print "First check:  All blocks must be within one of the master blocks\n";
     19print "Checking master containment...\n";
    2020
    2121# First check - make sure ALL routes and allocated blocks are part
    2222# of one of the master blocks.
    23 print "Checking routed blocks: ";
     23print "  Checking routed blocks:";
    2424$sth = $dbh->prepare("select cidr from routed");
    25 # union select cidr from allocations union select cidr from freeblocks");
    26 $sth->execute;
     25$sth->execute;
     26$flag = '';
    2727ROUTED: while (@data = $sth->fetchrow_array) {
    2828  $cidr = new NetAddr::IP $data[0];
     
    3030    if ($master->contains($cidr)) { next ROUTED; }
    3131  }
    32   print "$cidr not mastered\n";
    33 }
    34 print " done.\n";
     32  print "\n    $cidr not mastered";
     33}
     34print "$flag done.\n";
    3535
    3636# Next test:  All allocations must be part of a master.
    37 print "Checking allocations: ";
     37print "  Checking allocations:";
    3838$sth = $dbh->prepare("select cidr from allocations");
    3939$sth->execute;
     40$flag = '';
    4041ALLOCATED: while (@data = $sth->fetchrow_array) {
    4142  $cidr = new NetAddr::IP $data[0];
     
    4344    if ($master->contains($cidr)) { next ALLOCATED; }
    4445  }
    45   print "$cidr not mastered\n";
    46 }
    47 print " done.\n";
     46  print "\n    $cidr not mastered";
     47  $flag = "\n ";
     48}
     49print "$flag done.\n";
    4850
    4951# Next:  free blocks
    50 print "Checking freeblocks: ";
     52print "  Checking freeblocks:";
    5153$sth = $dbh->prepare("select cidr from freeblocks order by cidr");
    5254$sth->execute;
     55$flag = '';
    5356FREEBLOCK: while (@data = $sth->fetchrow_array) {
    5457  $cidr = new NetAddr::IP $data[0];
     
    5659    if ($master->contains($cidr)) { next FREEBLOCK; }
    5760  }
    58   print "$cidr not mastered\n";
    59 }
    60 print " done.\n";
    61 
    62 print "Done checking master containment.\n\nChecking pool containment:\n";
     61  print "\n    $cidr not mastered";
     62  $flag = "\n ";
     63}
     64print "$flag done.\n";
     65
     66print "Done checking master containment.\n\n";
     67
     68print "Checking pool containment...\n";
    6369
    6470$sth = $dbh->prepare("select pool,ip from poolips order by ip");
     
    6773  $pool = new NetAddr::IP $data[0];
    6874  $ip = new NetAddr::IP $data[1];
    69   print "IP $ip listed with incorrect pool $pool\n"
     75  print "  IP $ip listed with incorrect pool $pool\n"
    7076    if !$pool->contains($ip);
    7177}
     
    7581  $sth2 = $dbh->prepare("select cidr from allocations where cidr='$data[0]'");
    7682  $sth2->execute;
    77   print "Pool $data[0] does not exist in allocations table\n"
     83  print "  Pool $data[0] does not exist in allocations table\n"
    7884    if (($sth2->fetchrow_array)[0] eq '');
    7985}
    8086
    81 print "Done checking pool containment.\n\nChecking block-alignment consistency:\n";
     87print "Done checking pool containment.\n\n";
     88
     89print "Checking block-alignment consistency...\n";
    8290
    8391# Block alignment consistency:  All allocated+free blocks within a master
     
    95103
    96104foreach $master (@masterblocks) {
    97   print "Master $master:\n";
     105  print "  Master $master:\n";
    98106  $prev = $master;
    99107  $sth = $dbh->prepare("(select network(cidr) as net, broadcast(cidr) as bcast ".
    100         " from allocations where cidr <<= '$master') union ".
    101         "(select network(cidr) as net, broadcast(cidr) as bcast ".
    102         "from freeblocks where cidr <<= '$master') order by net");
     108        "from allocations where cidr <<= '$master' and type not like '_c') ".
     109        "union (select network(cidr) as net, broadcast(cidr) as bcast ".
     110        "from freeblocks where cidr <<= '$master' and not (routed='c')) order by net");
    103111  $sth->execute;
    104112
     
    109117      # check if cur starts with master
    110118      if ($cur->numeric > $prev->numeric) {
    111         print " Gap from start of master $master to first block $cur\n";
     119        print "    Gap from start of master $master to first block $cur\n";
    112120      } elsif ($cur->numeric < $prev->numeric) {
    113         print " BIG problem!  Current block $cur begins before master $master!\n";
     121        print "    BIG problem!  Current block $cur begins before master $master!\n";
    114122      }
    115123    } else {
    116124      if ($cur->numeric < ($prev->numeric + 1)) {
    117         print " Block ".$prev->network." overlaps block $cur\n";
     125        print "    Block ".$prev->network." overlaps block $cur\n";
    118126      } elsif ($cur->numeric > ($prev->numeric + 1)) {
    119         print " Gap between end of block ".$prev->network." and block $cur\n";
     127        print "    Gap between end of block ".$prev->network." and block $cur\n";
    120128      }
    121129    }
     
    129137  $master--;
    130138  if ($cur->numeric ne $master->numeric) {
    131     print " Gap from $cur to end of master at $master\n";
    132   }
    133   print "done $master.\n";
    134 }
    135 
    136 print "Done checking block alignment.\n\nChecking for correctness on 'defined' CustIDs:\n";
     139    print "    Gap from $cur to end of master at $master\n";
     140  }
     141  print "  done $master.\n";
     142}
     143
     144print "Done checking block alignment.\n\n";
     145
     146print "Checking containment on container blocks...\n";
     147# First, we need a list of containers.
     148# Then, we check all of the contained blocks to see if they're within
     149# the proper container.
     150$sth = $dbh->prepare("select cidr from allocations where type like '_c' order by cidr");
     151$sth->execute;
     152$i=0;
     153while (@data = $sth->fetchrow_array) {
     154  $containers[$i++] = new NetAddr::IP $data[0];
     155}
     156print "  Checking general containment:";
     157$sth = $dbh->prepare("select cidr from allocations where type like '_r' order by cidr");
     158$sth->execute;
     159$flag = '';
     160CONTAINED: while (@data = $sth->fetchrow_array) {
     161  $cidr = new NetAddr::IP $data[0];
     162  foreach $container (@containers) {
     163    next CONTAINED if $container->contains($cidr);
     164  }
     165  print "\n    $cidr not contained";
     166  $flag = "\n ";
     167}
     168print "$flag done.\n";
     169print "  Checking alignment:\n";
     170foreach $container (@containers) {
     171  print "    Container $container:\n";
     172  $prev = $container;
     173  $sth = $dbh->prepare("(select network(cidr) as net, broadcast(cidr) as bcast ".
     174        "from allocations where cidr <<= '$container' and type like '_r') ".
     175        "union (select network(cidr) as net, broadcast(cidr) as bcast ".
     176        "from freeblocks where cidr <<= '$container' and routed='w') order by net");
     177    $sth->execute;
     178
     179  while (@data = $sth->fetchrow_array) {
     180    $cur = new NetAddr::IP $data[0];
     181
     182    if ($container->numeric == $prev->numeric) {
     183      # check if cur starts with master
     184      if ($cur->numeric > $prev->numeric) {
     185        print "      Gap from start of container $container to first block $cur\n";
     186      } elsif ($cur->numeric < $prev->numeric) {
     187        print "      BIG problem!  Current block $cur begins before container $container!\n";
     188      }
     189    } else {
     190      if ($cur->numeric < ($prev->numeric + 1)) {
     191        print "      Block ".$prev->network." overlaps block $cur\n";
     192      } elsif ($cur->numeric > ($prev->numeric + 1)) {
     193        print "      Gap between end of block ".$prev->network." and block $cur\n";
     194      }
     195    }
     196
     197    $prev = $cur;
     198    $prev--;
     199
     200  } # while (@data...)
     201
     202  $cur--;
     203  $container--;
     204  if ($cur->numeric ne $container->numeric) {
     205    print "      Gap from $cur to end of container at $container\n";
     206  }
     207  print "    done $container.\n";
     208
     209}
     210print "  done container alignment.\n";
     211print "Done checking container containment.\n\n";
     212
     213print "Checking for correctness on 'defined' CustIDs:\n";
    137214# New check:  Make sure "defined" CustIDs are correct.
    138215$sth = $dbh->prepare("select cidr,type,custid from allocations where not type='cn' order by cidr");
  • branches/stable/cgi-bin/ipdb.psql

    r185 r192  
    120120GRANT ALL on "cities" to "ipdb";
    121121
     122--
     123-- Selected TOC Entries:
     124--
     125\connect - ipdb
     126
     127--
     128-- TOC Entry ID 2 (OID 92809)
     129--
     130-- Name: alloctypes Type: TABLE Owner: ipdb
     131--
     132
     133CREATE TABLE "alloctypes" (
     134        "type" character(2) DEFAULT '' NOT NULL,
     135        "listname" character varying(40) DEFAULT '',
     136        "dispname" character varying(40) DEFAULT '',
     137        "listorder" integer DEFAULT 0,
     138        "def_custid" character varying(16) DEFAULT '',
     139        Constraint "alloctypes_pkey" Primary Key ("type")
     140);
     141
     142--
     143-- TOC Entry ID 3 (OID 92809)
     144--
     145-- Name: alloctypes Type: ACL Owner:
     146--
     147
     148REVOKE ALL on "alloctypes" from PUBLIC;
     149GRANT ALL on "alloctypes" to "kdeugau";
     150GRANT ALL on "alloctypes" to "ipdb";
     151
     152--
     153-- Data for TOC Entry ID 4 (OID 92809)
     154--
     155-- Name: alloctypes Type: TABLE DATA Owner: ipdb
     156--
     157
     158
    122159COPY "alloctypes" FROM stdin;
    123160cd      Static Pool - Cable     Cable pool      41      CBL-BUS
     
    125162mp      Static Pool - Dialup    Static dialup pool      43      DIAL-BUS
    126163wp      Static Pool - Wireless  Static wireless pool    44      WL-BUS
    127 dc      Dynamic cable block     Dynamic cable block     103     CBL-RES
    128 dy      Dynamic DSL block       Dynamic DSL block       102     DSL-RES
    129 dn      Dialup netblock Dialup netblock 101     DIAL-RES
    130 dw      Dynamic WiFi block      Dynamic WiFi block      104     WL-RES
    131164mm      Master block    Master block    999     6750400
    132 rr      Routing Routed netblock 500     6750400
    133165in      Internal netblock       Internal netblock       990     6750400
    134 ee      End-use netblock        End-use netblock        100     6750400
    135166sd      Static Pool - Servers   Server pool     40      6750400
    136167cn      Customer netblock       Customer netblock       0       
     
    140171wi      Static IP - Wireless    Static wireless IP      24     
    141172si      Static IP - Server pool Server pool IP  20      6750400
     173wc      Reserve for WAN blocks  WAN IP blocks   200     6750400
     174wr      Internal WAN block      Internal WAN block      201     6750400
     175pc      Reserve for dynamic-route DSL netblocks Dynamic-route netblocks 202     6750400
     176en      End-use netblock        End-use netblock        100     6750400
     177me      Dialup netblock Dialup netblock 101     DIAL-RES
     178de      Dynamic DSL block       Dynamic DSL block       102     DSL-RES
     179ce      Dynamic cable block     Dynamic cable block     103     CBL-RES
     180we      Dynamic WiFi block      Dynamic WiFi block      104     WL-RES
     181rm      Routing Routed netblock 500     6750400
     182pr      Dynamic-route DSL netblock      Dynamic-route DSL       203     
    142183\.
  • branches/stable/cgi-bin/main.cgi

    r185 r192  
    325325
    326326  while (my @data = $sth->fetchrow_array) {
    327     # cidr,custid,type,city,description,notes
    328     # Fix up types from pools (which are single-char)
    329     # Fixing the database would be...  painful.  :(
    330 ##fixme LEGACY CODE
    331     if ($data[2] =~ /^[cdsmw]$/) {
    332       $data[2] .= 'i';
    333     }
    334     my @row = (qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
     327    # cidr,custid,type,city,description
     328    # Prefix subblocks with "Sub "
     329    my @row = ( (($data[2] =~ /^.r$/) ? 'Sub ' : '').
     330        qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
    335331        $data[1], $disp_alloctypes{$data[2]}, $data[3], $data[4]);
    336332    # Allow listing of pool if desired/required.
     
    599595#    $data[2] =~ s/\s+//g;
    600596
    601     my @row = ("<a href=\"/ip/cgi-bin/main.cgi?action=edit&block=$data[0]\">$data[0]</a>",
     597    # Prefix subblocks with "Sub "
     598    my @row = ( (($data[2] =~ /^.r$/) ? 'Sub ' : '').
     599        qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
    602600        $data[1], $disp_alloctypes{$data[2]}, $data[3], $data[4]);
    603601    # If the allocation is a pool, allow listing of the IPs in the pool.
     
    622620        qq(<input type=hidden name=action value="delete">\n).
    623621        qq(<input type=hidden name=block value="$master">\n).
    624         qq(<input type=hidden name=alloctype value="rr">\n).
     622        qq(<input type=hidden name=alloctype value="rm">\n).
    625623        qq(<input type=submit value=" Remove this block ">\n).
    626624        qq(</form>\n);
     
    635633  # unrouted free blocks, but it's better to let the database do the work if we can.
    636634  $count = 0;
    637   $sth = $ip_dbh->prepare("select cidr from freeblocks where routed='y' and cidr <<= '$master' order by cidr");
     635  $sth = $ip_dbh->prepare("select cidr,routed from freeblocks where cidr <<= '$master'".
     636        " order by cidr");
    638637  $sth->execute();
    639638  while (my @data = $sth->fetchrow_array()) {
    640     # cidr,maskbits,city
     639    # cidr,routed
    641640    my $cidr = new NetAddr::IP $data[0];
    642     my @row = ("<a href=\"/ip/cgi-bin/main.cgi?action=assign&block=$cidr\">$cidr</a>",
     641    # Include some HairyPerl(TM) to prefix subblocks with "Sub "
     642    my @row = ((($data[1] ne 'y' && $data[1] ne 'n') ? 'Sub ' : '').
     643        qq(<a href="/ip/cgi-bin/main.cgi?action=assign&block=$cidr&fbtype=$data[1]">$cidr</a>),
    643644        $cidr->range);
    644645    printRow(\@row, 'color1') if ($count%2 == 0);
     
    730731    $html =~ s|\$\$MASKBITS\$\$|$block->masklen|;
    731732    my $typelist = '';
    732     $sth = $ip_dbh->prepare("select type,listname from alloctypes where listorder < 500 and type not like '_i' order by listorder");
    733     $sth->execute;
    734     my @data = $sth->fetchrow_array;
    735     $typelist .= "<option value='$data[0]' selected>$data[1]</option>\n";
    736     while (my @data = $sth->fetchrow_array) {
    737       $typelist .= "<option value='$data[0]'>$data[1]</option>\n";
     733
     734    # This is a little dangerous, as it's *theoretically* possible to
     735    # get fbtype='n' (aka a non-routed freeblock).  However, should
     736    # someone manage to get there, they get what they deserve.
     737    if ($webvar{fbtype} ne 'y') {
     738      # Snag the type of the block from the database.  We have no
     739      # convenient way to pass this in from the calling location.  :/
     740      $sth = $ip_dbh->prepare("select type from allocations where cidr >>='$block'");
     741      $sth->execute;
     742      my @data = $sth->fetchrow_array;
     743      $data[0] =~ s/c$/r/;      # Munge the type into the correct form
     744      $typelist = "$list_alloctypes{$data[0]}<input type=hidden name=alloctype value=$data[0]>\n";
     745    } else {
     746      $typelist .= qq(<select name="alloctype">\n);
     747      $sth = $ip_dbh->prepare("select type,listname from alloctypes where listorder < 500 ".
     748        "and type not like '_i' and type not like '_r' order by listorder");
     749      $sth->execute;
     750      my @data = $sth->fetchrow_array;
     751      $typelist .= "<option value='$data[0]' selected>$data[1]</option>\n";
     752      while (my @data = $sth->fetchrow_array) {
     753        $typelist .= "<option value='$data[0]'>$data[1]</option>\n";
     754      }
     755      $typelist .= "</select>\n";
    738756    }
    739757    $html =~ s|\$\$TYPELIST\$\$|$typelist|g;
     
    839857      my $city;
    840858      my $failmsg;
    841       if ($webvar{alloctype} eq 'rr') {
     859      if ($webvar{alloctype} eq 'rm') {
    842860        if ($webvar{allocfrom} ne '-') {
    843861          $sql = "select * from freeblocks where maskbits<=$webvar{maskbits} and routed='n'".
     
    853871##fixme
    854872# This section needs serious Pondering.
    855         if ($webvar{alloctype} =~ /^.[pd]$/) {
     873        # Pools of all types get assigned to the POP they're "routed from"
     874        # This includes WAN blocks and other netblock "containers"
     875        if ($webvar{alloctype} =~ /^.[pdc]$/) {
    856876          if (($webvar{city} !~ /^(Sudbury|North Bay)$/) && ($webvar{alloctype} eq 'dp')) {
    857877            printError("You must chose Sudbury or North Bay for DSL pools.");
     
    870890        if ($webvar{allocfrom} ne '-') {
    871891          $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
    872                 " and cidr <<= '$webvar{allocfrom}' and routed='y' order by cidr,maskbits desc";
     892                " and cidr <<= '$webvar{allocfrom}' and routed='".
     893                (($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y')."' order by maskbits desc,cidr";
    873894        } else {
    874895          $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
    875                 " and routed='y' order by cidr,maskbits desc";
     896                " and routed='".(($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y').
     897                "' order by maskbits desc,cidr";
    876898        }
    877899      }
     
    955977    } else {
    956978      print qq(<div class="center"><div class="heading">The block $webvar{fullcidr} was ).
    957         "sucessfully added as type '$webvar{alloctype}' ".
    958         "($disp_alloctypes{$webvar{alloctype}})</div></div>";
     979        "sucessfully added as: $disp_alloctypes{$webvar{alloctype}}</div></div>";
    959980    }
    960981    syslog "notice", "$authuser allocated '$webvar{fullcidr}' to '$webvar{custid}' as ".
     
    963984    syslog "err", "Allocation of '$webvar{fullcidr}' to '$webvar{custid}' as ".
    964985        "'$webvar{alloctype}' by $authuser failed: '$msg'";
    965     printError("Allocation of $webvar{fullcidr} as $disp_alloctypes{$webvar{alloctype}}".
     986    printError("Allocation of $webvar{fullcidr} as '$disp_alloctypes{$webvar{alloctype}}'".
    966987        " failed:<br>\n$msg\n");
    967988  }
     
    10231044  # Check POP location
    10241045  my $flag;
    1025   if ($webvar{alloctype} eq 'rr') {
     1046  if ($webvar{alloctype} eq 'rm') {
    10261047    $flag = 'for a routed netblock';
    10271048    foreach (@poplist) {
     
    10951116# this has now been Requested, so here goes.
    10961117
    1097   if ($data[2] =~ /^d[nyc]|cn|ee|in$/) {
     1118##fixme The check here should be built from the database
     1119  if ($data[2] =~ /^.[ne]$/) {
    10981120    # Block that can be changed
    10991121    my $blockoptions = "<select name=alloctype><option".
    1100         (($data[2] eq 'dn') ? ' selected' : '') ." value='dn'>Dialup netblock</option>\n<option".
    1101         (($data[2] eq 'dy') ? ' selected' : '') ." value='dy'>Dynamic DSL netblock</option>\n<option".
    1102         (($data[2] eq 'dc') ? ' selected' : '') ." value='dc'>Dynamic cable netblock</option>\n<option".
     1122        (($data[2] eq 'me') ? ' selected' : '') ." value='me'>Dialup netblock</option>\n<option".
     1123        (($data[2] eq 'de') ? ' selected' : '') ." value='de'>Dynamic DSL netblock</option>\n<option".  (($data[2] eq 'dc') ? ' selected' : '') ." value='dc'>Dynamic cable netblock</option>\n<option".
     1124        (($data[2] eq 'ce') ? ' selected' : '') ." value='ce'>Dynamic cable netblock</option>\n<option".        (($data[2] eq 'dc') ? ' selected' : '') ." value='dc'>Dynamic cable netblock</option>\n<option".
     1125        (($data[2] eq 'we') ? ' selected' : '') ." value='we'>Dynamic wireless netblock</option>\n<option".     (($data[2] eq 'dc') ? ' selected' : '') ." value='dc'>Dynamic cable netblock</option>\n<option".
    11031126        (($data[2] eq 'cn') ? ' selected' : '') ." value='cn'>Customer netblock</option>\n<option".
    1104         (($data[2] eq 'ee') ? ' selected' : '') ." value='ee'>End-use netblock</option>\n<option".
     1127        (($data[2] eq 'en') ? ' selected' : '') ." value='en'>End-use netblock</option>\n<option".
    11051128        (($data[2] eq 'in') ? ' selected' : '') ." value='in'>Internal netblock</option>\n".
    11061129        "</select>\n";
     
    11991222  my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype);
    12001223
    1201   if ($webvar{alloctype} eq 'rr') {
     1224  if ($webvar{alloctype} eq 'rm') {
    12021225    $sth = $ip_dbh->prepare("select cidr,city from routed where cidr='$webvar{block}'");
    12031226    $sth->execute();
     
    12231246    $desc = "N/A";
    12241247    $notes = "N/A";
    1225   } elsif ($webvar{alloctype} =~ /^.i$/) { # done with alloctype=rr
     1248  } elsif ($webvar{alloctype} =~ /^.i$/) { # done with alloctype=[rm]m
    12261249
    12271250    # Unassigning a static IP
  • branches/stable/fb-assign.html

    r98 r192  
    1313<tr class="color1">
    1414<td>Allocation type:</td><td>
    15 <select name="alloctype">
    1615$$TYPELIST$$
    17 </select>
    1816<input type="button" value=" ? " onclick="helpAllocTypes()" class="regular">
    1917</td>
Note: See TracChangeset for help on using the changeset viewer.