Changeset 856
- Timestamp:
- 09/15/22 16:56:41 (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB/ExportBIND.pm
r855 r856 48 48 $revsth->execute(); 49 49 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; 52 52 # my $cachefile = "$dnsdb->{exportcache}/$zfile"; 53 53 # my $tmpcache = "$dnsdb->{exportcache}/tmp.$zfile.$$"; … … 57 57 ##fixme: need to bodge logical non-octet-boundary revzones into octet-boundary revzones 58 58 ##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; 59 63 60 64 … … 77 81 my (@loclist) = $dnsdb->{dbh}->selectrow_array("SELECT DISTINCT location FROM records WHERE rdns_id = ?", undef, $revid); 78 82 push @loclist, $defloc unless grep /$defloc/, @loclist; 79 my $zonepath = $dnsdb->{bind_export_ zone_path};83 my $zonepath = $dnsdb->{bind_export_reverse_zone_path}; 80 84 my %zonefiles; # to be a list of file handles. 81 ##fixme: convert logical revzone into .arpa name85 ##fixme: need to open separate zone files for aggregated metazones eg /22 or /14 82 86 foreach my $loc (@loclist) { 83 87 my $zfilepath = $zonepath; 84 88 $zfilepath =~ s/\%view/$loc/; 85 89 $zfilepath =~ s/\%zone/$revzone/; 90 my $arpazone = DNSDB::_ZONE($cidr, 'ZONE', 'r', '.').($cidr->{isv6} ? '.ip6.arpa' : '.in-addr.arpa'); 91 $zfilepath =~ s/\%arpazone/$arpazone/; 86 92 # Just In Case(TM) 87 93 $zfilepath =~ s,[^\w./-],_,g; -
trunk/dnsdb.conf
r849 r856 30 30 ## BIND export options 31 31 #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 32 34 33 35 ## DNS data template options
Note:
See TracChangeset
for help on using the changeset viewer.