Changeset 866 for trunk


Ignore:
Timestamp:
09/20/22 17:58:38 (2 years ago)
Author:
Kris Deugau
Message:

/trunk

BIND export, unwinding dev saves, 18 of many many

  • Move publish_template_bind() out of PTR template block to file-level, since it's called from several blocks, and in any case subs-of-subs aren't actually a thing in Perl as of writing
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB/ExportBIND.pm

    r865 r866  
    360360    return if $val->{isv6};
    361361
     362    if ($val->masklen <= 16) {
     363      foreach my $sub ($val->split(16)) {
     364        __publish_template_bind($sub, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 1);
     365      }
     366    } else {
     367      __publish_template_bind($val, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 1);
     368    }
     369  } # PTR template
     370
     371  elsif ($type == 65283) { # A+PTR template
     372    $val = NetAddr::IP->new($val);
     373    # Just In Case.  An A+PTR should be impossible to add to a v6 revzone via API.
     374    return if $val->{isv6};
     375
     376    if ($val->masklen < 16) {
     377      foreach my $sub ($val->split(16)) {
     378        __publish_template_bind($sub, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 0);
     379      }
     380    } else {
     381      __publish_template_bind($val, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 0);
     382    }
     383  } # A+PTR template
     384 
     385  elsif ($type == 65284) { # AAAA+PTR template
     386    # Stub for completeness.  Could be exported to DNS software that supports
     387    # some degree of internal automagic in generic-record-creation
     388    # (eg http://search.cpan.org/dist/AllKnowingDNS/ )
     389  } # AAAA+PTR template
     390
     391} # printrec_bind()
     392
     393
    362394sub __publish_template_bind {
    363395  my $sub = shift;
     
    410442    }
    411443  }
    412 } # __publish_subnet_bind()
    413 
    414     if ($val->masklen <= 16) {
    415       foreach my $sub ($val->split(16)) {
    416         __publish_subnet($sub, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 1);
    417       }
    418     } else {
    419       __publish_subnet($val, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 1);
    420     }
    421   } # PTR template
    422 
    423   elsif ($type == 65283) { # A+PTR template
    424     $val = NetAddr::IP->new($val);
    425     # Just In Case.  An A+PTR should be impossible to add to a v6 revzone via API.
    426     return if $val->{isv6};
    427 
    428     if ($val->masklen < 16) {
    429       foreach my $sub ($val->split(16)) {
    430         $self->__publish_subnet($sub, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 0);
    431       }
    432     } else {
    433       $self->__publish_subnet($val, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 0);
    434     }
    435   } # A+PTR template
    436  
    437   elsif ($type == 65284) { # AAAA+PTR template
    438     # Stub for completeness.  Could be exported to DNS software that supports
    439     # some degree of internal automagic in generic-record-creation
    440     # (eg http://search.cpan.org/dist/AllKnowingDNS/ )
    441   } # AAAA+PTR template
    442 
    443 } # printrec_bind()
    444 
     444} # __publish_template_bind()
    445445
    4464461;
Note: See TracChangeset for help on using the changeset viewer.