Freeze and thaw zones when reloading
This commit is contained in:
Jamie Cameron
2011-05-28 19:01:42 -07:00
parent d5dee5e41a
commit e6ae025e18
2 changed files with 11 additions and 2 deletions

View 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.

View File

@@ -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();