Changeset 856


Ignore:
Timestamp:
09/15/22 16:56:41 (20 months ago)
Author:
Kris Deugau
Message:

/trunk

BIND export, unwinding dev saves, 8 of many many

  • More minor naming convention fiddles
  • Start eying up removing zone split from SOA record publication, because we need a zone file for each formal .arpa zone in an aggregated metazone (eg /22 or /14)
  • Introduce bind_export_reverse_zone_path config variable, so we can use either the CIDR address or the formal .arpa name for reverse zone file paths
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB/ExportBIND.pm

    r855 r856  
    4848  $revsth->execute();
    4949  while (my ($revid,$revzone,$revstat,$changed,$defloc) = $revsth->fetchrow_array) {
    50     my $tmpzone = NetAddr::IP->new($revzone);
    51     my $zfile = $tmpzone->network->addr."-".$tmpzone->masklen;
     50    my $cidr = NetAddr::IP->new($revzone);
     51    my $zfile = $cidr->network->addr."-".$cidr->masklen;
    5252#    my $cachefile = "$dnsdb->{exportcache}/$zfile";
    5353#    my $tmpcache = "$dnsdb->{exportcache}/tmp.$zfile.$$";
     
    5757##fixme:  need to bodge logical non-octet-boundary revzones into octet-boundary revzones
    5858##fixme:  do we do cache files?  views balloon the file count stupidly
     59## foreach $octetzone $cidr->split(octet-boundary)
     60##   loclist = SELECT DISTINCT location FROM records WHERE rdns_id = $zid AND inetlazy(val) <<= $octetzone
     61
     62#printf "non-octet? %s, %i\n", $cidr->masklen, $cidr->masklen % 8;
    5963
    6064
     
    7781        my (@loclist) = $dnsdb->{dbh}->selectrow_array("SELECT DISTINCT location FROM records WHERE rdns_id = ?", undef, $revid);
    7882        push @loclist, $defloc unless grep /$defloc/, @loclist;
    79         my $zonepath = $dnsdb->{bind_export_zone_path};
     83        my $zonepath = $dnsdb->{bind_export_reverse_zone_path};
    8084        my %zonefiles;  # to be a list of file handles.
    81 ##fixme:  convert logical revzone into .arpa name
     85##fixme:  need to open separate zone files for aggregated metazones eg /22 or /14
    8286        foreach my $loc (@loclist) {
    8387          my $zfilepath = $zonepath;
    8488          $zfilepath =~ s/\%view/$loc/;
    8589          $zfilepath =~ s/\%zone/$revzone/;
     90          my $arpazone = DNSDB::_ZONE($cidr, 'ZONE', 'r', '.').($cidr->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
     91          $zfilepath =~ s/\%arpazone/$arpazone/;
    8692          # Just In Case(TM)
    8793          $zfilepath =~ s,[^\w./-],_,g;
  • trunk/dnsdb.conf

    r849 r856  
    3030## BIND export options
    3131#bind_export_zone_path = /var/named/zones/%view/db.%zone
     32# because they're fish of a different colour
     33#bind_export_reverse_zone_path = /var/named/zones/%view/db.%arpazone
    3234
    3335## DNS data template options
Note: See TracChangeset for help on using the changeset viewer.