Changeset 267 for branches


Ignore:
Timestamp:
07/15/05 16:57:02 (19 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Oops, missed some possibilities in deliberatly ignoring private
IPs - need to allow for allocation types other than routing. >_<

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/main.cgi

    r266 r267  
    889889      my $city;
    890890      my $failmsg;
     891      my $extracond = '';
     892      if ($webvar{allocfrom} eq '-') {
     893        $extracond = ($webvar{allowpriv} eq 'on' ? '' :
     894                " and not (cidr <<= '192.168.0.0/16'".
     895                        " or cidr <<= '10.0.0.0/8'".
     896                        " or cidr <<= '172.16.0.0/12')");
     897      }
     898      my $sortorder;
    891899      if ($webvar{alloctype} eq 'rm') {
    892900        if ($webvar{allocfrom} ne '-') {
    893901          $sql = "select * from freeblocks where maskbits<=$webvar{maskbits} and routed='n'".
    894                 " and cidr <<= '$webvar{allocfrom}' order by maskbits desc";
     902                " and cidr <<= '$webvar{allocfrom}'";
     903          $sortorder = "maskbits desc";
    895904        } else {
    896           $sql = "select * from freeblocks where maskbits<=$webvar{maskbits} and routed='n'".
    897                 ($webvar{allowpriv} eq 'on' ? '' :
    898                 " and not (cidr <<= '192.168.0.0/16'".
    899                         " or cidr <<= '10.0.0.0/8'".
    900                         " or cidr <<= '172.16.0.0/12')").
    901                 " order by maskbits desc";
     905          $sql = "select * from freeblocks where maskbits<=$webvar{maskbits} and routed='n'";
     906          $sortorder = "maskbits desc";
    902907        }
    903908        $failmsg = "No suitable free block found.<br>\nWe do not have a free".
     
    928933          $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
    929934                " and cidr <<= '$webvar{allocfrom}' and routed='".
    930                 (($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y')."' order by maskbits desc,cidr";
     935                (($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y')."'";
     936          $sortorder = "maskbits desc,cidr";
    931937        } else {
    932938          $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
    933                 " and routed='".(($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y').
    934                 "' order by maskbits desc,cidr";
     939                " and routed='".(($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y')."'";
     940          $sortorder = "maskbits desc,cidr";
    935941        }
    936942      }
     943      $sql = $sql.$extracond." order by ".$sortorder;
    937944      $sth = $ip_dbh->prepare($sql);
    938945      $sth->execute;
Note: See TracChangeset for help on using the changeset viewer.