Changeset 675 for trunk/cgi-bin/main.cgi


Ignore:
Timestamp:
01/15/15 17:52:26 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Extend per-IP rDNS through the "confirm add" page and the "edit" page. See #1.

  • Add flag in getBlockRDNS return to indicate if the results are from local caching instead of RPC results. There isn't really a clear way to globally flag "RPC server is up".
  • Add a sub to retrieve per-IP reverse DNS information for a passed CIDR range. Not limited in IPDB.pm, but dnsadmin will refuse to return anything for a block larger than /24 (v4) or /120 (v6) - an 8 bit inverse mask.
  • Use the new sub on editing a small(ish) non-pool block. CSS magic notwithstanding, handling more than 32 IPs in a list like this is awkward.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/main.cgi

    r674 r675  
    313313    my $block = new NetAddr::IP $webvar{block};
    314314
    315     my $rdns = getBlockRDNS($ip_dbh, id => $webvar{parent}, type => $webvar{fbtype}, user => $authuser);
     315    my ($rdns,$cached) = getBlockRDNS($ip_dbh, id => $webvar{parent}, type => $webvar{fbtype}, user => $authuser);
    316316    $page->param(rdns => $rdns) if $rdns;
    317317    $page->param(parent => $webvar{parent});
    318318    $page->param(fbid => $webvar{fbid});
     319    # visual flag that we're working IPDB-local, not off more authoritative data in dnsadmin
     320    $page->param(cached => $cached);
    319321
    320322    $webvar{fbtype} = '' if !$webvar{fbtype};
     
    687689  $blockinfo->{type} =~ s/\s//;
    688690
     691  my $cached;
    689692  # Get rDNS info;  duplicates a bit of getBlockData but also does the RPC call if possible
    690   $blockinfo->{rdns} = getBlockRDNS($ip_dbh, id => $webvar{id}, type => $blockinfo->{type}, user => $authuser);
     693  ($blockinfo->{rdns},$cached) = getBlockRDNS($ip_dbh, id => $webvar{id}, type => $blockinfo->{type}, user => $authuser);
     694  # visual flag that we're working IPDB-local, not off more authoritative data in dnsadmin
     695  $page->param(cached => $cached);
     696
     697  my $cidr = new NetAddr::IP $blockinfo->{block};
     698  # Limit the per-IP rDNS list based on CIDR length;  larger ones just take up too much space.
     699  # Also, don't show on IP pools;  the individual IPs will have a space for rDNS
     700  # Don't show on single IPs;  these use the "pattern" field
     701  if ($IPDBacl{$authuser} =~ /c/
     702      && $cidr->masklen != $cidr->bits
     703      && ($cidr->bits - $cidr->masklen) <= $IPDB::maxrevlist
     704      && $webvar{alloctype} !~ /^.[dpi]/
     705      # do we want to allow v6 at all?
     706      #&& ! $cidr->{isv6}
     707      ) {
     708    $page->param(r_iplist => getRDNSbyIP($ip_dbh, id => $webvar{id}, type => $blockinfo->{type},
     709        range => $blockinfo->{block}, user => $authuser) );
     710  }
    691711
    692712  $page->param(block    => $blockinfo->{block});
Note: See TracChangeset for help on using the changeset viewer.