Changeset 637 for trunk/cgi-bin
- Timestamp:
- 10/09/14 18:06:51 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r636 r637 1559 1559 sub getBlockRDNS { 1560 1560 my $dbh = shift; 1561 my $block = shift;1562 my $rdepth = shift; # do we really need this?1563 1561 my %args = @_; 1564 1562 1565 $args{vrf} = '' if !$args{vrf}; 1566 1567 my $cidr = new NetAddr::IP $block; 1568 1569 my ($rdns,$rfrom) = $dbh->selectrow_array("SELECT rdns,cidr FROM allocations WHERE cidr >>= ? UNION ". 1570 "SELECT rdns,cidr FROM masterblocks WHERE cidr >>= ? ORDER BY cidr", undef, ($cidr,$cidr) ); 1563 $args{type} = 'b' if !$args{type}; 1564 1565 # snag entry from database 1566 my ($rdns,$rfrom,$pid); 1567 if ($args{type} =~ /.i/) { 1568 ($rdns, $rfrom, $pid) = $dbh->selectrow_array("SELECT rdns,ip,parent_id FROM poolips WHERE id = ?", 1569 undef, ($args{id}) ); 1570 } else { 1571 ($rdns, $rfrom, $pid) = $dbh->selectrow_array("SELECT rdns,cidr,parent_id FROM allocations WHERE id = ?", 1572 undef, ($args{id}) ); 1573 } 1574 1575 # Can't see a way this could end up empty, for any case I care about. If the caller 1576 # doesn't know an allocation ID to request, then they don't know anything else anyway. 1577 my $selfblock = $rfrom; 1578 1579 my $type; 1580 while (!$rdns && $pid) { 1581 ($rdns, $rfrom, $pid, $type) = $dbh->selectrow_array( 1582 "SELECT rdns,cidr,parent_id,type FROM allocations WHERE id = ?", 1583 undef, ($pid) ); 1584 last if $type eq 'mm'; # break loops in unfortunate legacy data 1585 } 1586 1587 # use the actual allocation to check against the DNS utility; we don't want 1588 # to always go chasing up the chain to the master... which may (usually won't) 1589 # be present directly in DNS anyway 1590 my $cidr = new NetAddr::IP $selfblock; 1571 1591 1572 1592 if ($rpc_url) { … … 1575 1595 1576 1596 my ($rpcblock) = ($cidr->masklen <= 24 ? $cidr->split( ($cidr->masklen <= 16 ? 16 : 24) ) : $cidr); 1577 1578 1597 my %rpcargs = ( 1579 1598 rpcuser => $args{user}, … … 1582 1601 ); 1583 1602 1584 $rdns = _rpc('getRevPattern', %rpcargs); 1603 my $remote_rdns = _rpc('getRevPattern', %rpcargs); 1604 $rdns = $remote_rdns if $remote_rdns; 1585 1605 } 1586 1606
Note:
See TracChangeset
for help on using the changeset viewer.