Changeset 856


Ignore:
Timestamp:
04/14/16 18:14:45 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Port back enhancement to db2rwhois.pl that skips trying to retrieve
customer-ish data for export on allocation types that have a default
customer ID. These types should, more or less by definition, have that
default set, and should not be used for customer allocations.

File:
1 edited

Legend:

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

    r680 r856  
    7373# Also remove the details of our "reserved CORE/WAN" blocks;  they're not critical.
    7474my $ssth = $dbh->prepare(q(
    75         SELECT cidr, custid, type, city, description, createstamp, modifystamp, swip
    76         FROM allocations
     75        SELECT a.cidr, a.custid, a.type, a.city, a.description, a.createstamp, a.modifystamp, a.swip, a.custid=t.def_custid AS isdef
     76        FROM allocations a JOIN alloctypes t ON a.type=t.type
    7777        WHERE
    78         NOT (cidr <<= '192.168.0.0/16') AND
    79         NOT (cidr <<= '172.16.0.0/12') AND
    80         NOT (cidr <<= '10.0.0.0/8') AND
    81         NOT (type = 'wr' OR type = 'mm') AND
    82         ((masklen(cidr) <=30 AND family(cidr)=4) OR (masklen(cidr) <=64 AND family(cidr)=6)) AND
    83         master_id = ? AND
    84         cidr <<= ?
     78        NOT (a.cidr <<= '192.168.0.0/16') AND
     79        NOT (a.cidr <<= '172.16.0.0/12') AND
     80        NOT (a.cidr <<= '10.0.0.0/8') AND
     81        NOT (a.type = 'wr' OR a.type = 'mm') AND
     82        ((masklen(a.cidr) <=30 AND family(a.cidr)=4) OR (masklen(a.cidr) <=64 AND family(a.cidr)=6)) AND
     83        a.master_id = ? AND
     84        a.cidr <<= ?
    8585        ) );
    8686
     
    217217  # And now the subblocks
    218218  $ssth->execute($mid, $master) or die "nosubs: $!\n".$dbh->errstr."\n";
    219   while (my ($cidr, $custid, $type, $city, $desc, $ctime, $mtime, $swip) = $ssth->fetchrow_array) {
     219  while (my ($cidr, $custid, $type, $city, $desc, $ctime, $mtime, $swip, $defcust) = $ssth->fetchrow_array) {
    220220
    221221# We get master block info from @masterblocks.
     
    266266    my $netname = $netnameprefix{$type};
    267267
    268     if ($swip eq 'n') {
     268    if ($swip eq 'n' || $defcust) {
    269269      print MASTERFILE "---\nID: NETBLK-$netnameprefix{mm}.$masterblocks[$i]\n".
    270270        "Auth-Area: $masterblocks[$i]\n".
Note: See TracChangeset for help on using the changeset viewer.