Changeset 308 for branches/stable


Ignore:
Timestamp:
02/28/06 17:45:43 (18 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Fixups and cleanups for rWHOIS export script.

File:
1 edited

Legend:

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

    r253 r308  
    2222my $rwhoisDataPath = "/etc/rwhoisd";
    2323
    24 # We'll pull this out of the database instead.  Just make sure our
    25 # master blocks are actually listed....  <g>
    26 #@masterblocks = (
    27 #               (new NetAddr::IP "209.91.128.0/18"),
    28 #               (new NetAddr::IP "66.186.64.0/19"),
    29 #               (new NetAddr::IP "192.168.99.0/24")
    30 #               );
    31 
    3224my ($dbh,$msg) = connectDB_My;
    3325
     
    4739
    4840# Techically, we only need to exclude 204.138.172.0/24, as we "own" all of the other blocks.
     41# However, 205.207.184.0/23 and 206.130.64.0/24 are, um, awkward.
    4942  if ($data[0] =~ /^(192.168.0.0|172.16.0.0|10.0.0.0|20[456])/) {
    5043    next GETMASTERS;
     
    8982# Make sure to remove the private netblocks from this.
    9083# No use or point in broadcasting our use of them.
     84# Also remove the details of our "reserved CORE/WAN" blocks;  they're not critical.
    9185$sth = $dbh->prepare("select cidr,custid,type,city,description,createstamp,modifystamp ".
    9286        "from allocations where ".
     
    9488        "not (cidr <<= '172.16.0.0/12') and ".
    9589        "not (cidr <<= '10.0.0.0/8') and ".
     90        "not (type = 'wr') and ".
    9691        "masklen(cidr) <=30");
    9792#" and (custid='6750400' or custid like '%-RES' or custid like '%-BUS')");
     
    132127# cidr custid type city description notes maskbits
    133128
    134 # Creation date in record to eventually be "correct";  near-term will
    135 # be master's creation date;  immediate is today's date.
    136 my $date;
    137       chomp ($date = `/bin/date +"%Y%m%d"`);
     129# Fill in a generic entry for nameless allocations
    138130if ($desc =~ /^\s*$/) { $desc = 'Friendly ISP'; }
    139 #print "$i:\t$net in $master\n";
     131
     132      # Fix up datestamps.  We don't *really* need sub-microsecond resolution on our exports...
     133      ($ctime) = ($ctime =~ /^(\d+-\d+-\d+)\s+/);
     134      ($mtime) = ($mtime =~ /^(\d+-\d+-\d+)\s+/);
    140135
    141136      print MASTERFILE "---\nID: NETBLK-ISP.$master\n".
Note: See TracChangeset for help on using the changeset viewer.