Index: /trunk/DNSDB/ExportBIND.pm
===================================================================
--- /trunk/DNSDB/ExportBIND.pm	(revision 898)
+++ /trunk/DNSDB/ExportBIND.pm	(revision 899)
@@ -709,4 +709,44 @@
   } # AAAA+PTR template
 
+  elsif ($type == 65300) { # ALIAS
+    # Implemented as a unique record in parallel with many other
+    # management tools, for clarity VS formal behviour around CNAME
+    # Mainly for "root CNAME" or "apex alias";  limited value for any
+    # other use case since CNAME can generally be used elsewhere.
+
+    # .arpa zones don't need this hack.  shouldn't be allowed into
+    # the DB in the first place, but Just In Case...
+    return if $revrec eq 'y';
+
+    my ($iplist) = $dnsdb->{dbh}->selectrow_array("SELECT auxdata FROM records WHERE record_id = ?", undef, $recid);
+    $iplist = '' if !$iplist;
+
+    # shared target-name-to-IP converter
+    my $liveips = $dnsdb->_grab_65300($recid, $val);
+    # only update the cache if the live lookup actually returned data
+    if ($liveips && ($iplist ne $liveips)) {
+      $dnsdb->{dbh}->do("UPDATE records SET auxdata = ? WHERE record_id = ?", undef, $liveips, $recid);
+      $iplist = $liveips;
+    }
+
+    # slice the TTL we'll actually publish off the front
+    my @asubs = split ';', $iplist;
+    my $attl = shift @asubs;
+
+    # output a plain old A or AAAA record for each IP the target name really points to.
+    # in the event that, for whatever reason, no A/AAAA records are available for $val, nothing will be output.
+    foreach my $subip (@asubs) {
+      my $recdata;
+      if ($subip =~ /\d+\.\d+\.\d+\.\d+/) {
+        $recdata = "$host.     $attl   IN      A       $subip\n";
+      } else {
+        $recdata = "$host.     $attl   IN      AAAA    $subip\n";
+      }
+      __recprint($zonefiles, $loclist, $loc, $recdata);
+    }
+
+ } # ALIAS
+
+
 } # printrec_bind()
 
