Changeset 317 for branches/stable


Ignore:
Timestamp:
03/31/06 17:01:56 (19 years ago)
Author:
Kris Deugau
Message:

/branches/stable

freespace.pl fixup; more cleanly remove private netblocks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/freespace.pl

    r305 r317  
    2020$tnumfree = $bigrfree = $bigufree = 0;
    2121
     22$sql = 'select * from freeblocks where ';
    2223# General counts first
    2324if ($ARGV[0]) {
    24   $sth = $dbh->prepare("select * from freeblocks where maskbits >= $ARGV[0] order by maskbits desc");
    25 } else {
    26   $sth = $dbh->prepare("select * from freeblocks order by maskbits desc");
     25  $sql .= 'maskbits >= $ARGV[0] and ';
    2726}
     27$sql .= "not (cidr <<= '192.168.0.0/16') ".
     28                "and not (cidr <<= '172.16.0.0/12') ".
     29                "and not (cidr <<= '10.0.0.0/8') ";
     30$sql .= "order by maskbits desc";
     31
     32$sth = $dbh->prepare($sql);
    2833$sth->execute;
    2934while (@data = $sth->fetchrow_array) {
    3035  # cidr,maskbits,city,routed
    31   next if $data[0] =~ /^10\./;
    32   #next if $data[0] =~ /^172\.16\./;
    33   next if $data[0] =~ /^192\.168\./;
    3436  $tnumfree++;
    3537  $numfree{"$data[1]"}++;
Note: See TracChangeset for help on using the changeset viewer.