Changeset 675 for trunk/cgi-bin/IPDB.pm
- Timestamp:
- 01/15/15 17:52:26 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r674 r675 32 32 &getMasterList &getTypeList &getPoolSelect &findAllocateFrom 33 33 &ipParent &subParent &blockParent &getRoutedCity 34 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS 34 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS &getRDNSbyIP 35 35 &getNodeList &getNodeName &getNodeInfo 36 36 &mailNotify … … 47 47 &getMasterList &getTypeList &getPoolSelect &findAllocateFrom 48 48 &ipParent &subParent &blockParent &getRoutedCity 49 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS 49 &allocateBlock &updateBlock &deleteBlock &getBlockData &getBlockRDNS &getRDNSbyIP 50 50 &getNodeList &getNodeName &getNodeInfo 51 51 &mailNotify … … 1680 1680 1681 1681 $args{type} = 'b' if !$args{type}; 1682 my $cached = 1; 1682 1683 1683 1684 # snag entry from database … … 1721 1722 my $remote_rdns = _rpc('getRevPattern', %rpcargs); 1722 1723 $rdns = $remote_rdns if $remote_rdns; 1724 $cached = 0; 1723 1725 } 1724 1726 1725 1727 # hmm. do we care about where it actually came from? 1726 return $rdns ;1728 return $rdns, $cached; 1727 1729 } # end getBlockRDNS() 1730 1731 1732 ## IPDB::getRDNSbyIP() 1733 # Get individual reverse entries for the IP or CIDR IP range passed. Sort of looking the 1734 # opposite direction down the netblock tree compared to getBlockRDNS() above. 1735 sub getRDNSbyIP { 1736 my $dbh = shift; 1737 my %args = @_; # We want to accept a variety of call types 1738 1739 # key arguments: allocation ID, type 1740 unless ($args{id} || $args{type}) { 1741 $errstr = 'Missing allocation ID or type'; 1742 return; 1743 } 1744 1745 my @ret = (); 1746 # special case: single IP. Check if it's an allocation or in a pool, then do the RPC call for fresh data. 1747 if ($args{type} =~ /^.i$/) { 1748 my ($ip, $localrev) = $dbh->selectrow_array("SELECT ip, rdns FROM poolips WHERE id = ?", undef, ($args{id}) ); 1749 push @ret, { 'r_ip' => $ip, 'iphost' => $localrev }; 1750 } else { 1751 if ($rpc_url) { 1752 my %rpcargs = ( 1753 rpcuser => $args{user}, 1754 group => $revgroup, # not sure how this could sanely be exposed, tbh... 1755 cidr => $args{range}, 1756 ); 1757 1758 my $remote_rdns = _rpc('getRevSet', %rpcargs); 1759 return $remote_rdns; 1760 # $rdns = $remote_rdns if $remote_rdns; 1761 # $cached = 0; 1762 } 1763 } 1764 return \@ret; 1765 } # end getRDNSbyIP() 1728 1766 1729 1767
Note:
See TracChangeset
for help on using the changeset viewer.