- Timestamp:
- 01/02/14 17:29:27 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/cgi-bin/extras/db2rwhois.pl
r601 r618 68 68 # no use or point in broadcasting our use of them. 69 69 # Also remove the details of our "reserved CORE/WAN" blocks; they're not critical. 70 my $ssth = $dbh->prepare("select cidr,custid,type,city,description,createstamp,modifystamp,swip ". 71 "from allocations where ". 72 "not (cidr <<= '192.168.0.0/16') and ". 73 "not (cidr <<= '172.16.0.0/12') and ". 74 "not (cidr <<= '10.0.0.0/8') and ". 75 "not (type = 'wr') and ". 76 "((masklen(cidr) <=30 and family(cidr)=4) or (masklen(cidr) <=56 and family(cidr)=6)) and ". 77 "cidr <<= ?"); 70 my $ssth = $dbh->prepare(qq( 71 SELECT a.cidr,a.custid,a.type,a.city,a.description,a.createstamp,a.modifystamp,a.swip,a.custid=t.def_custid AS isdef 72 FROM allocations a JOIN alloctypes t ON a.type=t.type WHERE 73 NOT (a.cidr <<= '192.168.0.0/16') AND 74 NOT (a.cidr <<= '172.16.0.0/12') AND 75 NOT (a.cidr <<= '10.0.0.0/8') AND 76 NOT (a.type = 'wr') AND 77 ((masklen(a.cidr) <=30 AND family(a.cidr)=4) OR (masklen(a.cidr) <=56 AND family(a.cidr)=6)) AND 78 a.cidr <<= ? 79 )); 78 80 79 81 # Customer data, for those rare blocks we really need to delegate. … … 206 208 # And now the subblocks 207 209 $ssth->execute("$masterblocks[$i]"); 208 while (my ($cidr, $custid, $type, $city, $desc, $ ctime, $mtime, $swip) = $ssth->fetchrow_array) {210 while (my ($cidr, $custid, $type, $city, $desc, $bctime, $bmtime, $swip, $defcust) = $ssth->fetchrow_array) { 209 211 210 212 # We get master block info from @masterblocks. … … 233 235 234 236 # Fix up datestamps. We don't *really* need sub-microsecond resolution on our exports... 235 ($ ctime) = ($ctime =~ /^(\d+-\d+-\d+)\s+/);236 ($ mtime) = ($mtime =~ /^(\d+-\d+-\d+)\s+/);237 ($bctime) = ($bctime =~ /^(\d+-\d+-\d+)\s+/); 238 ($bmtime) = ($bmtime =~ /^(\d+-\d+-\d+)\s+/); 237 239 238 240 # Notes: … … 255 257 my $netname = $netnameprefix{$type}; 256 258 257 if ($swip eq 'n') { 258 print MASTERFILE "---\nID: NETBLK-ISP.$masterblocks[$i]\n". 259 "Auth-Area: $masterblocks[$i]\n". 260 "Network-Name: $netname-".$net->network."\n". 261 "IP-Network: $net\n". 262 "IP-Network-Block: ".$net->range."\n". 263 "Org-Name: $IPDB::org_name\n". 264 "Street-Address: $IPDB::org_street\n". 265 "City: $IPDB::org_city\n". 266 "StateProv: $IPDB::org_prov_state\n". 267 "Postal-Code: $IPDB::org_pocode\n". 268 "Country-Code: $IPDB::org_country\n". 269 "Tech-Contact: $IPDB::org_techhandle\n". 270 "Created: $ctime\n". 271 "Updated: $mtime\n". 272 "Updated-By: $IPDB::org_email\n"; 259 # le sigh. can't get a proper report on what is undef if this is all one big print. 260 if ($swip eq 'n' || $defcust) { 261 print MASTERFILE "---\nID: NETBLK-ISP$masterblocks[$i]\n"; 262 print MASTERFILE "Auth-Area: $masterblocks[$i]\n"; 263 print MASTERFILE "Network-Name: $netname-".$net->network."\n"; 264 print MASTERFILE "IP-Network: $net\n"; 265 print MASTERFILE "IP-Network-Block: ".$net->range."\n"; 266 print MASTERFILE "Org-Name: $IPDB::org_name\n"; 267 print MASTERFILE "Street-Address: $IPDB::org_street\n"; 268 print MASTERFILE "City: $IPDB::org_city\n"; 269 print MASTERFILE "StateProv: $IPDB::org_prov_state\n"; 270 print MASTERFILE "Postal-Code: $IPDB::org_pocode\n"; 271 print MASTERFILE "Country-Code: $IPDB::org_country\n"; 272 print MASTERFILE "Tech-Contact: $IPDB::org_techhandle\n"; 273 print MASTERFILE "Created: $bctime\n"; 274 print MASTERFILE "Updated: $bmtime\n"; 275 print MASTERFILE "Updated-By: $IPDB::org_email\n"; 273 276 } else { 274 277 $custsth->execute($custid);
Note:
See TracChangeset
for help on using the changeset viewer.