Changeset 581


Ignore:
Timestamp:
01/02/14 13:22:11 (11 years ago)
Author:
Kris Deugau
Message:

/trunk

Add an option to show the formal .arpa zone name for reverse zone NS
records instead of the logical CIDR zone.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r578 r581  
    213213                force_refresh   => 1,
    214214                lowercase       => 0,   # mangle as little as possible by default
     215                showrec_arpa_ns => 0,   # show formal .arpa zone name instead of logical CIDR on reverse NS records
    215216        );
    216217
     
    242243
    243244  # Several settings are booleans.  Handle multiple possible ways of setting them.
    244   for my $boolopt ('log_failures', 'force_refresh', 'lowercase', 'usecache') {
     245  for my $boolopt ('log_failures', 'force_refresh', 'lowercase', 'usecache', 'showrec_arpa_ns') {
    245246    if ($self->{$boolopt} ne '1' && $self->{$boolopt} ne '0') {
    246247      # true/false, on/off, yes/no all valid.
     
    13421343      $cfg->{force_refresh}     = $1 if /^force_refresh\s*=\s*([a-z01]+)/i;
    13431344      $cfg->{lowercase}         = $1 if /^lowercase\s*=\s*([a-z01]+)/i;
     1345      $cfg->{showrec_arpa_ns}   = $1 if /^showrec_arpa_ns\s*=\s*([a-z01]+)/i;
    13441346# not supported in dns.cgi yet
    13451347#      $cfg->{templatedir}      = $1 if m{^templatedir\s*=\s*([a-z0-9/_.-]+)}i;
  • trunk/dns.cgi

    r570 r581  
    20042004
    20052005  foreach my $rec (@$foo2) {
     2006    # NS records.  Need to do this first before we convert the type-value to the text representation
     2007    if ($rev eq 'y' && $dnsdb->{showrec_arpa_ns} && $rec->{type} == $reverse_typemap{NS}) {
     2008      my $tmp = new NetAddr::IP $rec->{val};
     2009      $rec->{val} = DNSDB::_ZONE($tmp, 'ZONE', 'r', '.').($tmp->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
     2010    }
    20062011    $rec->{type} = $typemap{$rec->{type}};
    20072012    $rec->{fwdzone} = $rev eq 'n';
  • trunk/dnsdb.conf

    r559 r581  
    3838#lowercase = 0
    3939
     40# Show formal .arpa zone name instead of usual CIDR for reverse zone NS records?
     41#showrec_arpa_ns = 0
     42
    4043## General RPC options
    4144# may already be obsolete.  how do we want to run RPC requests?
  • trunk/export.pl

    r496 r581  
    2929my $dnsdb = new DNSDB;
    3030
     31#open TINYDATA, ">small/tinydata";
    3132open TINYDATA, ">tinydata";
    3233
    33 $dnsdb->export('tiny', *TINYDATA);
     34$dnsdb->export('tiny', *TINYDATA) or die "fatal: ".$dnsdb->errstr."\n";
  • trunk/textrecs.cgi

    r580 r581  
    8383  $rec->{val} = "$rec->{distance}  $rec->{weight}  $rec->{port}  $rec->{val}" if $rec->{type} eq 'SRV';
    8484  if ($webvar{revrec} eq 'y') {
     85    if ($dnsdb->{showrec_arpa_ns} && $rec->{type} eq 'NS') {
     86      my $tmp = new NetAddr::IP $rec->{val};
     87      $rec->{val} = DNSDB::_ZONE($tmp, 'ZONE', 'r', '.').($tmp->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
     88    }
    8589    printf "%-16s\t%d\t%s\t%s\n", $rec->{val}, $rec->{ttl}, $rec->{type}, $rec->{host};
    8690  } else {
Note: See TracChangeset for help on using the changeset viewer.