Changeset 189


Ignore:
Timestamp:
03/08/05 17:37:46 (20 years ago)
Author:
Kris Deugau
Message:

/trunk

Caught some buglets in the HairyPerl(TM) ('$1' vs "$1")
Corrected a potentially annoying SQL buglet relating to the

selection of which netblock an allocation is to be taken from;
under certain conditions it would pick a larger block to slice
up while there was still a perfectly usable block just the
right size waiting to be allocated.

Removed display of back-end alloctypes from success/failure notes
Corrected comments referring to alloctypes that have been altered
Updated IPDB "default" schema and alloctypes list with current

base information

Location:
trunk/cgi-bin
Files:
3 edited

Legend:

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

    r187 r189  
    332332          $sth->execute;
    333333
    334         } else { # done with alloctype == rr
     334        } else { # done with alloctype == rm
    335335
    336336          # Insert the new freeblocks entries
     
    339339          $sth = $dbh->prepare("insert into freeblocks (cidr,maskbits,city,routed)".
    340340                " values (?, ?, (select city from routed where cidr >>= '$cidr'),'".
    341                 (($type =~ /^(.)r$/) ? '$1' : 'y')."')");
     341                (($type =~ /^(.)r$/) ? "$1" : 'y')."')");
    342342          foreach my $block (@newfreeblocks) {
    343343            $sth->execute("$block", $block->masklen);
     
    370370          }
    371371
    372         } # done with netblock alloctype != rr
     372        } # done with netblock alloctype != rm
    373373
    374374        $dbh->commit;
     
    577577                " values ('$cidr',".$cidr->masklen.
    578578                ",(select city from routed where cidr >>= '$cidr'),'".
    579                 (($type =~ /^(.)r$/) ? '$1' : 'y')."')");
     579                (($type =~ /^(.)r$/) ? "$1" : 'y')."')");
    580580      }
    581581      $sth->execute;
  • trunk/cgi-bin/ipdb.psql

    r187 r189  
    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 ce      Dynamic cable block     Dynamic cable block     103     CBL-RES
    128 de      Dynamic DSL block       Dynamic DSL block       102     DSL-RES
    129 me      Dialup netblock Dialup netblock 101     DIAL-RES
    130 we      Dynamic WiFi block      Dynamic WiFi block      104     WL-RES
    131164mm      Master block    Master block    999     6750400
    132 rm      Routing Routed netblock 500     6750400
    133165in      Internal netblock       Internal netblock       990     6750400
    134 en      End-use netblock        End-use netblock        100     6750400
    135166sd      Static Pool - Servers   Server pool     40      6750400
    136167cn      Customer netblock       Customer netblock       0       
     
    143174wr      Internal WAN block      Internal WAN block      201     6750400
    144175pc      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
    145182pr      Dynamic-route DSL netblock      Dynamic-route DSL       203     
    146183\.
  • trunk/cgi-bin/main.cgi

    r187 r189  
    890890          $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
    891891                " and cidr <<= '$webvar{allocfrom}' and routed='".
    892                 (($webvar{alloctype} =~ /^(.)r$/) ? '$1' : 'y')."' order by cidr,maskbits desc";
     892                (($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y')."' order by maskbits desc,cidr";
    893893        } else {
    894894          $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
    895                 " and routed='".(($webvar{alloctype} =~ /^(.)r$/) ? '$1' : 'y').
    896                 "' order by cidr,maskbits desc";
     895                " and routed='".(($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y').
     896                "' order by maskbits desc,cidr";
    897897        }
    898898      }
     
    976976    } else {
    977977      print qq(<div class="center"><div class="heading">The block $webvar{fullcidr} was ).
    978         "sucessfully added as type '$webvar{alloctype}' ".
    979         "($disp_alloctypes{$webvar{alloctype}})</div></div>";
     978        "sucessfully added as: $disp_alloctypes{$webvar{alloctype}}</div></div>";
    980979    }
    981980    syslog "notice", "$authuser allocated '$webvar{fullcidr}' to '$webvar{custid}' as ".
     
    984983    syslog "err", "Allocation of '$webvar{fullcidr}' to '$webvar{custid}' as ".
    985984        "'$webvar{alloctype}' by $authuser failed: '$msg'";
    986     printError("Allocation of $webvar{fullcidr} as $disp_alloctypes{$webvar{alloctype}}".
     985    printError("Allocation of $webvar{fullcidr} as '$disp_alloctypes{$webvar{alloctype}}'".
    987986        " failed:<br>\n$msg\n");
    988987  }
     
    12321231    $desc = "N/A";
    12331232    $notes = "N/A";
    1234   } elsif ($webvar{alloctype} =~ /^.i$/) { # done with alloctype=rr
     1233  } elsif ($webvar{alloctype} =~ /^.i$/) { # done with alloctype=[rm]m
    12351234
    12361235    # Unassigning a static IP
Note: See TracChangeset for help on using the changeset viewer.