Index: trunk/DNSDB/ExportBIND.pm
===================================================================
--- trunk/DNSDB/ExportBIND.pm	(revision 864)
+++ trunk/DNSDB/ExportBIND.pm	(revision 865)
@@ -47,4 +47,7 @@
   my $zonesth = $dnsdb->{dbh}->prepare("UPDATE revzones SET changed='n' WHERE rdns_id=?");
   $revsth->execute();
+
+  my %recflags;  # need this to be independent for forward vs reverse zones, as they're not merged
+
   while (my ($revid,$revzone,$revstat,$changed,$defloc) = $revsth->fetchrow_array) {
     my $cidr = NetAddr::IP->new($revzone);
@@ -101,5 +104,6 @@
         $soasth->execute($revid);
         my (@zsoa) = $soasth->fetchrow_array();
-        printrec_bind(\%zonefiles, $zsoa[7], 'y', \@loclist, $revzone,
+##fixme: do we even need @loclist passed in?
+        printrec_bind(\%zonefiles, $zsoa[7], 'y', \%recflags, $revzone,
           $zsoa[0],$zsoa[1],$zsoa[2],$zsoa[3],$zsoa[4],$zsoa[5],$zsoa[6],$zsoa[8],'');
 
@@ -216,5 +220,7 @@
 sub printrec_bind {
   my $dnsdb = shift;
-  my ($zonefiles, $recid, $revrec, $loclist, $zone, $host, $type, $val, $distance, $weight, $port, $ttl,
+
+#  my ($zonefiles, $recid, $revrec, $loclist, $zone, $host, $type, $val, $distance, $weight, $port, $ttl,
+  my ($zonefiles, $recid, $revrec, $recflags, $zone, $host, $type, $val, $distance, $weight, $port, $ttl,
 	$loc, $stamp, $expires, $stampactive) = @_;
 
@@ -335,5 +341,5 @@
     $$recflags{$val}++;
     if ($revrec eq 'y') {
-      printrec_bind($zonefiles, $recid, $revrec, $loclist, $zone, $host, 12, $val, $distance, $weight, $port, $ttl,
+      printrec_bind($zonefiles, $recid, $revrec, $recflags, $zone, $host, 12, $val, $distance, $weight, $port, $ttl,
        $loc, $stamp, $expires, $stampactive);
 #print {$zonefiles->{$loc}} "=$host:$val:$ttl:$stamp:$loc\n" or die $!;
@@ -343,5 +349,5 @@
 #        $loc, $stamp, $expires, $stampactive) = @_;
     } else {
-      printrec_bind($zonefiles, $recid, $revrec, $loclist, $zone, $host, 1, $val, $distance, $weight, $port, $ttl,
+      printrec_bind($zonefiles, $recid, $revrec, $recflags, $zone, $host, 1, $val, $distance, $weight, $port, $ttl,
        $loc, $stamp, $expires, $stampactive);
     }
@@ -415,4 +421,24 @@
   } # PTR template
 
+  elsif ($type == 65283) { # A+PTR template
+    $val = NetAddr::IP->new($val);
+    # Just In Case.  An A+PTR should be impossible to add to a v6 revzone via API.
+    return if $val->{isv6};
+
+    if ($val->masklen < 16) {
+      foreach my $sub ($val->split(16)) {
+        $self->__publish_subnet($sub, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 0);
+      }
+    } else {
+      $self->__publish_subnet($val, $recflags, $host, $zonefiles->{$loc}, $ttl, $stamp, $loc, $zone, 0);
+    }
+  } # A+PTR template
+ 
+  elsif ($type == 65284) { # AAAA+PTR template
+    # Stub for completeness.  Could be exported to DNS software that supports
+    # some degree of internal automagic in generic-record-creation
+    # (eg http://search.cpan.org/dist/AllKnowingDNS/ )
+  } # AAAA+PTR template
+
 } # printrec_bind()
 
