Commit af3770ed authored by Witold Krecicki's avatar Witold Krecicki
Browse files

rndc reconfig reports configuration errors the same way rndc reload does [RT #39635]

parent a8cb6c6f
4137. [cleanup] rndc reconfig reports configuration errors the same
way rndc reload does [RT #39635]
4136. [bug] Stale statistics counters with the leading
'#' prefix (such as #NXDOMAIN) were not being
updated correctly. This has been fixed. [RT #39141]
......
......@@ -101,7 +101,7 @@ ns_control_docommand(isccc_sexpr_t *message, isc_buffer_t **text) {
if (command_compare(command, NS_COMMAND_RELOAD)) {
result = ns_server_reloadcommand(ns_g_server, command, text);
} else if (command_compare(command, NS_COMMAND_RECONFIG)) {
result = ns_server_reconfigcommand(ns_g_server, command);
result = ns_server_reconfigcommand(ns_g_server);
} else if (command_compare(command, NS_COMMAND_REFRESH)) {
result = ns_server_refreshcommand(ns_g_server, command, text);
} else if (command_compare(command, NS_COMMAND_RETRANSFER)) {
......
......@@ -244,7 +244,7 @@ ns_server_reloadcommand(ns_server_t *server, char *args, isc_buffer_t **text);
*/
isc_result_t
ns_server_reconfigcommand(ns_server_t *server, char *args);
ns_server_reconfigcommand(ns_server_t *server);
/*%<
* Act on a "reconfig" command from the command channel.
*/
......
......@@ -7200,25 +7200,6 @@ reload(ns_server_t *server) {
return (result);
}
static void
reconfig(ns_server_t *server) {
isc_result_t result;
CHECK(loadconfig(server));
result = load_new_zones(server, ISC_FALSE);
if (result == ISC_R_SUCCESS)
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_INFO,
"any newly configured zones are now loaded");
else
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
"loading new zones failed: %s",
isc_result_totext(result));
cleanup: ;
}
/*
* Handle a reload event (from SIGHUP).
*/
......@@ -7476,11 +7457,23 @@ ns_server_reloadcommand(ns_server_t *server, char *args, isc_buffer_t **text) {
* Act on a "reconfig" command from the command channel.
*/
isc_result_t
ns_server_reconfigcommand(ns_server_t *server, char *args) {
UNUSED(args);
ns_server_reconfigcommand(ns_server_t *server) {
isc_result_t result;
reconfig(server);
return (ISC_R_SUCCESS);
CHECK(loadconfig(server));
result = load_new_zones(server, ISC_FALSE);
if (result == ISC_R_SUCCESS)
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_INFO,
"any newly configured zones are now loaded");
else
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
"loading new zones failed: %s",
isc_result_totext(result));
cleanup:
return (result);
}
/*
......
......@@ -411,4 +411,19 @@ grep "ISC_R_SUCCESS 0" rndc.output > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:test 'rndc reconfig' with a broken config"
ret=0
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > /dev/null || ret=1
sleep 1
mv ns4/named.conf ns4/named.conf.save
echo "error error error" >> ns4/named.conf
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > rndc.output 2>&1 && ret=1
grep "rndc: 'reconfig' failed: unexpected token" rndc.output > /dev/null || ret=1
mv ns4/named.conf.save ns4/named.conf
sleep 1
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf reconfig > /dev/null || ret=1
sleep 1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
exit $status
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment