]> git.openstreetmap.org Git - dns.git/commitdiff
Output A records for the default name instead of CNAME records
authorTom Hughes <tom@compton.nu>
Mon, 12 Aug 2013 16:54:47 +0000 (17:54 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 12 Aug 2013 16:54:47 +0000 (17:54 +0100)
bin/mkgeo

index 33a05b0e5086f11123bccd5e80914291e7a70da0..dcc192aab73271c861f7237a05cae8d21829be13 100755 (executable)
--- a/bin/mkgeo
+++ b/bin/mkgeo
@@ -225,11 +225,11 @@ while (my($name,$cluster) = each %$clusters)
 {
     if (my $default = $cluster->{default})
     {
-        $zonefile->print("C${default}.${zone}:${name}.${zone}:600\n");
+        output_server($zonefile, "${default}.${zone}", $cluster);
     }
     elsif (exists($cluster->{default}))
     {
-        $zonefile->print("C${zone}:${name}.${zone}:600\n");
+        output_server($zonefile, "${zone}", $cluster);
     }
 }
 
@@ -239,18 +239,7 @@ $zonefile->print("# Servers\n");
 # Output A records for each cluster
 while (my($name,$cluster) = each %$clusters)
 {
-    foreach my $server (@{$cluster->{servers}})
-    {
-        if ($server->{status} eq "up")
-        {
-            $zonefile->print("+${name}.${zone}:$server->{ipv4}:600\n");
-
-            if ($server->{ipv6})
-            {
-#                $zonefile->print("3${name}.${zone}:$server->{ipv6}:600\n");
-            }
-        }
-    }
+    output_server($zonefile, "${name}.${zone}", $cluster);
 }
 
 # Output the GeoJSON text
@@ -394,3 +383,28 @@ sub compare_bandwidth
 
     return $a_used <=> $b_used;
 }
+
+#
+# Output DNS records for a server
+#
+sub output_server
+{
+    my $zonefile = shift;
+    my $name = shift;
+    my $cluster = shift;
+
+    foreach my $server (@{$cluster->{servers}})
+    {
+        if ($server->{status} eq "up")
+        {
+            $zonefile->print("+${name}:$server->{ipv4}:600\n");
+
+            if ($server->{ipv6})
+            {
+#                $zonefile->print("3${name}:$server->{ipv6}:600\n");
+            }
+        }
+    }
+
+    return;
+}