https://www.virtualmin.com/node/18338
authorJamie Cameron <jcameron@webmin.com>
Sun, 29 May 2011 02:01:42 +0000 (19:01 -0700)
committerJamie Cameron <jcameron@webmin.com>
Sun, 29 May 2011 02:01:42 +0000 (19:01 -0700)
Freeze and thaw zones when reloading

bind8/CHANGELOG
bind8/bind8-lib.pl

index 8bd2f5a..665e64e 100644 (file)
@@ -129,3 +129,4 @@ IPv6 addresses can now be used for remote nameservers in slave and delegation zo
 Added the Test Zone Transfer button to the slave zone page, to check if zone transfers are possible or not.
 ---- Changes since 1.550 ----
 Links for editing and deleting records now using the record name instead of an index, which makes editing more reliable if records are also being updated by dynamic DNS or some other tool.
+When a zone is reloaded, it is now frozed first and then thawed afterwards with the rndc command, to better support dynamic DNS.
index bf69151..93878da 100755 (executable)
@@ -1911,15 +1911,23 @@ return undef;
 sub restart_zone
 {
 local ($dom, $view) = @_;
-local $out;
+local ($out, $ex);
 if ($view) {
        # Reload a zone in a view
+       &try_cmd("freeze ".quotemeta($dom)." IN ".quotemeta($view).
+                " 2>&1 </dev/null");
        $out = &try_cmd("reload ".quotemeta($dom)." IN ".quotemeta($view).
                        " 2>&1 </dev/null");
+       $ex = $?;
+       &try_cmd("thaw ".quotemeta($dom)." IN ".quotemeta($view).
+                " 2>&1 </dev/null");
        }
 else {
        # Just reload one top-level zone
+       &try_cmd("freeze ".quotemeta($dom)." 2>&1 </dev/null");
        $out = &try_cmd("reload ".quotemeta($dom)." 2>&1 </dev/null");
+       $ex = $?;
+       &try_cmd("thaw ".quotemeta($dom)." 2>&1 </dev/null");
        }
 if ($out =~ /not found/i) {
        # Zone is not known to BIND yet - do a total reload
@@ -1937,7 +1945,7 @@ if ($out =~ /not found/i) {
                        }
                }
        }
-elsif ($? || $out =~ /failed|not found|error/i) {
+elsif ($ex || $out =~ /failed|not found|error/i) {
        return &text('restart_endc', "<tt>".&html_escape($out)."</tt>");
        }
 &refresh_nscd();