Changeset 863 for trunk


Ignore:
Timestamp:
09/20/22 16:25:48 (2 years ago)
Author:
Kris Deugau
Message:

/trunk

BIND export, unwinding dev saves, 15 of many many

  • Refine PTR record printing to actually print BIND-format records
  • Add A+PTR output, which just calls recursively for A or PTR records
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB/ExportBIND.pm

    r862 r863  
    322322      if ($val =~ /\.arpa$/) {
    323323        # someone put in the formal .arpa name.  humor them.
    324         print {$zonefiles->{$loc}} "^$val:$host:$ttl:$stamp:$loc\n" or die $!;
     324        print {$zonefiles->{$loc}} "$val        $ttl    IN      PTR     $host\n" or die $!;
    325325      } else {
    326326        $zone = NetAddr::IP->new($zone);
     
    328328          # sub-octet v4 zone
    329329          ($val) = ($val =~ /\.(\d+)$/);
    330           print {$zonefiles->{$loc}} "^$val.".DNSDB::_ZONE($zone, 'ZONE', 'r', '.').'.in-addr.arpa'.
    331             ":$host:$ttl:$stamp:$loc\n" or die $!;
     330          print {$zonefiles->{$loc}} "$val.".DNSDB::_ZONE($zone, 'ZONE', 'r', '.').'.in-addr.arpa'.
     331                "       $ttl    IN      PTR     $host\n"
     332                or die $!;
    332333        } else {
    333334          # not going to care about strange results if $val is not an IP value and is resolveable in DNS
    334335          $val = NetAddr::IP->new($val);
    335           print {$zonefiles->{$loc}} "^".
    336             DNSDB::_ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa').
    337             ":$host:$ttl:$stamp:$loc\n" or die $!;
     336          print {$zonefiles->{$loc}} DNSDB::_ZONE($val, 'ZONE', 'r', '.').($val->{isv6} ? '.ip6.arpa' : '.in-addr.arpa').
     337                "       $ttl    IN      PTR     $host\n"
     338                or die $!;
     339
    338340        }
    339341      } # non-".arpa" $val
     
    347349  } # PTR
    348350
     351  elsif ($type == 65280) { # A+PTR
     352    # Recurse to PTR or A as appropriate because BIND et al don't share
     353    # the tinydns concept of merged forward/reverse records
     354#    $$recflags{$val}++;
     355    if ($revrec eq 'y') {
     356      printrec_bind($zonefiles, $recid, $revrec, $loclist, $zone, $host, 12, $val, $distance, $weight, $port, $ttl,
     357       $loc, $stamp, $expires, $stampactive);
     358#print {$zonefiles->{$loc}} "=$host:$val:$ttl:$stamp:$loc\n" or die $!;
     359#          printrec_bind(\%zonefiles, $recid, 'y', \@loclist, $revzone,
     360#            $host, $type, $val, $dist, $weight, $port, $ttl, $loc, $stamp, $expires, $stampactive);
     361#  my ($zonefiles, $recid, $revrec, $loclist, $zone, $host, $type, $val, $distance, $weight, $port, $ttl,
     362#        $loc, $stamp, $expires, $stampactive) = @_;
     363    } else {
     364      printrec_bind($zonefiles, $recid, $revrec, $loclist, $zone, $host, 1, $val, $distance, $weight, $port, $ttl,
     365       $loc, $stamp, $expires, $stampactive);
     366    }
     367  } # A+PTR
     368
    349369} # printrec_bind()
    350370
Note: See TracChangeset for help on using the changeset viewer.