Changeset 867 for trunk


Ignore:
Timestamp:
09/20/22 18:13:37 (2 years ago)
Author:
Kris Deugau
Message:

/trunk

BIND export, unwinding dev saves, 19 of many many

  • Tweak fixed arguments for some calls to publish_template_bind() and tweak sub to match
  • More intermediate broom-pushing calling _ZONE
  • Actually output some records in publish_template_bind()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB/ExportBIND.pm

    r866 r867  
    376376    if ($val->masklen < 16) {
    377377      foreach my $sub ($val->split(16)) {
    378         __publish_template_bind($sub, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 0);
     378        __publish_template_bind($sub, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 'y');
    379379      }
    380380    } else {
    381       __publish_template_bind($val, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 0);
     381      __publish_template_bind($val, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 'y');
    382382    }
    383383  } # A+PTR template
     
    401401  my $loc = shift;
    402402  my $zone = new NetAddr::IP shift;
    403   my $ptrflag = shift || 0;    ##fixme:  default to PTR instead of A record for the BIND variant of this sub?
     403  my $revrec = shift || 'y';
     404#  my $ptrflag = shift || 0;    ##fixme:  default to PTR instead of A record for the BIND variant of this sub?
    404405
    405406  # do this conversion once, not (number-of-ips-in-subnet) times
    406   my $arpabase = _ZONE($zone, 'ZONE.in-addr.arpa', 'r', '.');
     407  my $arpabase = DNSDB::_ZONE($zone, 'ZONE.in-addr.arpa', 'r', '.');
    407408
    408409  my $iplist = $sub->splitref(32);
     
    429430    next if !$rec;
    430431##fixme:  trim merged record type voodoo.  "if ($ptrflag) {} else {}" ?
    431     if ($ptrflag || $zone->masklen > 24) {
     432#    if ($ptrflag || $zone->masklen > 24) {
     433    if ($revrec eq 'y' || $zone->masklen > 24) {
    432434#      print $fh "^$lastoct.$arpabase:$rec:$ttl:$stamp:$loc\n" or die $!;
     435##fixme: use $ORIGIN instead?  make the FQDN output switchable-optional?
    433436      print $fh "$lastoct.$arpabase    $ttl    IN      PTR     $rec\n" or die $!;
    434       if (!$ptrflag) {
     437#      if (!$ptrflag) {
     438      if ($revrec ne 'y') {
    435439        # print a separate A record.  Arguably we could use an = record here instead.
    436440#        print $fh "+$rec:$ip:$ttl:$stamp:$loc\n" or die $!;
     441        print $fh "$rec $ttl    IN      A       $ip\n" or die $!;
    437442      }
    438443    } else {
    439444      # A record, not merged
    440445#      print $fh "=$rec:$ip:$ttl:$stamp:$loc\n" or die $!;
    441       print $fh "$rec  $ttl    IN      A       $ip\n" or die $!;
     446      print $fh "$rec   $ttl    IN      A       $ip\n" or die $!;
    442447    }
    443448  }
Note: See TracChangeset for help on using the changeset viewer.