Hi, I just started trying out Vegadns and one of the first things I noticed was that, unless clocks are synced, CPU and network load on the nameservers equal, then the SOA serial generated by tinydns-data can hardly be guaranteed to be the same. Although tinydns won't care about this it doesn't look particularly good to the outside world since it leads people to believe that there might be some discrepances between the servers if serials differ.

I guess you could just as well add a column in the domains-table with the timestamp, but I can't/don't want to modify the database structure at this time, so instead, attatched to this mail is a patch that sort-of fixes the problem by generating a stable serial each time a "?state=get_data" request is recieved within a certain time interval.

//conny
diff -ru vegadns-0.6.1/src/functions.php ../vegadns/src/functions.php
--- vegadns-0.6.1/src/functions.php	Sun Jan 25 23:12:39 2004
+++ ../vegadns/src/functions.php	Tue Apr  6 16:25:16 2004
@@ -340,7 +340,7 @@
         $s = "C".$row['host'].":".$row['val'].":".$row['ttl']."\n";
     } else if($row['type'] == 'S') {
         $soa = parse_soa($row);
-        $s = "Z".$domain.":".$soa['tldhost'].":".$soa['tldemail']."::".$soa['refresh'].":".$soa['retry'].":".$soa['expire'].":".$soa['minimum'].":".$soa['ttl']."\n";
+        $s = "Z".$domain.":".$soa['tldhost'].":".$soa['tldemail'].":".get_serial().":".$soa['refresh'].":".$soa['retry'].":".$soa['expire'].":".$soa['minimum'].":".$soa['ttl']."\n";
     } else {
         $s = "\n";
     }
@@ -405,6 +405,16 @@
     }
     return $out_array;
 
+}
+
+function get_serial($domain = null) {
+	// Maybe we'll have per-domain timestamps at some point?
+	// For now - just make a simple quantification (get nearest multiple of N)
+
+	$quanta = 60; // Nearest full minute since Unix epoch start
+	$serial = intval( time() / $quanta ) * $quanta;
+
+	return $serial;
 }
 
 // END FUNCTIONS

Reply via email to