Commit 9dafd058 authored by Andreas Gustafsson's avatar Andreas Gustafsson

implemented 'rndc reconfig'

parent fd59e595
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: control.c,v 1.3 2001/04/11 20:37:33 bwelling Exp $ */
/* $Id: control.c,v 1.4 2001/05/07 23:33:58 gson Exp $ */
#include <config.h>
......@@ -79,6 +79,8 @@ ns_control_docommand(isccc_sexpr_t *message) {
*/
if (command_compare(command, NS_COMMAND_RELOAD)) {
result = ns_server_reloadcommand(ns_g_server, command);
} else if (command_compare(command, NS_COMMAND_RECONFIG)) {
result = ns_server_reconfigcommand(ns_g_server, command);
} else if (command_compare(command, NS_COMMAND_REFRESH)) {
result = ns_server_refreshcommand(ns_g_server, command);
} else if (command_compare(command, NS_COMMAND_HALT)) {
......@@ -89,13 +91,6 @@ ns_control_docommand(isccc_sexpr_t *message) {
ns_server_flushonshutdown(ns_g_server, ISC_TRUE);
isc_app_shutdown();
result = ISC_R_SUCCESS;
} else if (command_compare(command, NS_COMMAND_RELOADCONFIG) ||
command_compare(command, NS_COMMAND_RELOADZONES)) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_CONTROL, ISC_LOG_WARNING,
"unimplemented channel command '%s'",
command);
result = ISC_R_NOTIMPLEMENTED;
} else if (command_compare(command, NS_COMMAND_DUMPSTATS)) {
result = ns_server_dumpstats(ns_g_server);
} else if (command_compare(command, NS_COMMAND_QUERYLOG)) {
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: control.h,v 1.3 2001/04/11 20:37:36 bwelling Exp $ */
/* $Id: control.h,v 1.4 2001/05/07 23:34:01 gson Exp $ */
#ifndef NAMED_CONTROL_H
#define NAMED_CONTROL_H 1
......@@ -29,8 +29,7 @@
#define NS_COMMAND_STOP "stop"
#define NS_COMMAND_HALT "halt"
#define NS_COMMAND_RELOAD "reload"
#define NS_COMMAND_RELOADCONFIG "reload-config"
#define NS_COMMAND_RELOADZONES "reload-zones"
#define NS_COMMAND_RECONFIG "reconfig"
#define NS_COMMAND_REFRESH "refresh"
#define NS_COMMAND_DUMPSTATS "stats"
#define NS_COMMAND_QUERYLOG "querylog"
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.h,v 1.53 2001/04/11 20:37:37 bwelling Exp $ */
/* $Id: server.h,v 1.54 2001/05/07 23:34:02 gson Exp $ */
#ifndef NAMED_SERVER_H
#define NAMED_SERVER_H 1
......@@ -118,6 +118,12 @@ ns_server_reloadcommand(ns_server_t *server, char *args);
* Act on a "reload" command from the command channel.
*/
isc_result_t
ns_server_reconfigcommand(ns_server_t *server, char *args);
/*
* Act on a "reconfig" command from the command channel.
*/
isc_result_t
ns_server_refreshcommand(ns_server_t *server, char *args);
/*
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.318 2001/04/19 23:38:32 bwelling Exp $ */
/* $Id: server.c,v 1.319 2001/05/07 23:34:00 gson Exp $ */
#include <config.h>
......@@ -2065,6 +2065,28 @@ load_zones(ns_server_t *server, isc_boolean_t stop) {
return (result);
}
static isc_result_t
load_new_zones(ns_server_t *server, isc_boolean_t stop) {
isc_result_t result;
dns_view_t *view;
result = isc_task_beginexclusive(server->task);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
/*
* Load zone data from disk.
*/
for (view = ISC_LIST_HEAD(server->viewlist);
view != NULL;
view = ISC_LIST_NEXT(view, link))
{
CHECK(dns_view_loadnew(view, stop));
}
cleanup:
isc_task_endexclusive(server->task);
return (result);
}
static void
run_server(isc_task_t *task, isc_event_t *event) {
isc_result_t result;
......@@ -2309,32 +2331,64 @@ fatal(const char *msg, isc_result_t result) {
exit(1);
}
static void
ns_server_reload(isc_task_t *task, isc_event_t *event) {
static isc_result_t
loadconfig(ns_server_t *server) {
isc_result_t result;
ns_server_t *server = (ns_server_t *)event->ev_arg;
result = load_configuration(ns_g_lwresdonly ?
lwresd_g_conffile : ns_g_conffile,
server,
ISC_FALSE);
if (result != ISC_R_SUCCESS)
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
"reloading configuration failed: %s",
isc_result_totext(result));
return (result);
}
INSIST(task = server->task);
UNUSED(task);
static void
reload(ns_server_t *server) {
isc_result_t result;
CHECK(loadconfig(server));
if (ns_g_lwresdonly)
result = load_configuration(lwresd_g_conffile, server,
ISC_FALSE);
else
result = load_configuration(ns_g_conffile, server, ISC_FALSE);
result = load_zones(server, ISC_FALSE);
if (result != ISC_R_SUCCESS) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
"reloading configuration failed: %s",
"reloading zones failed: %s",
isc_result_totext(result));
}
result = load_zones(server, ISC_FALSE);
cleanup: ;
}
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_ERROR,
"reloading zones failed: %s",
"loading new zones failed: %s",
isc_result_totext(result));
}
cleanup: ;
}
/*
* Handle a reload event (from SIGHUP).
*/
static void
ns_server_reload(isc_task_t *task, isc_event_t *event) {
isc_result_t result;
ns_server_t *server = (ns_server_t *)event->ev_arg;
INSIST(task = server->task);
UNUSED(task);
reload(server);
LOCK(&server->reload_event_lock);
INSIST(server->reload_event == NULL);
server->reload_event = event;
......@@ -2446,12 +2500,11 @@ ns_server_reloadcommand(ns_server_t *server, char *args) {
dns_zone_t *zone = NULL;
dns_zonetype_t type;
UNUSED(server);
result = zone_from_args(server, args, &zone);
if (result != ISC_R_SUCCESS)
return (result);
if (zone == NULL) {
ns_server_reloadwanted(server);
reload(server);
} else {
type = dns_zone_gettype(zone);
if (type == dns_zone_slave || type == dns_zone_stub)
......@@ -2463,6 +2516,17 @@ ns_server_reloadcommand(ns_server_t *server, char *args) {
return (ISC_R_SUCCESS);
}
/*
* Act on a "reconfig" command from the command channel.
*/
isc_result_t
ns_server_reconfigcommand(ns_server_t *server, char *args) {
UNUSED(args);
reconfig(server);
return (ISC_R_SUCCESS);
}
/*
* Act on a "refresh" command from the command channel.
*/
......
......@@ -2,7 +2,7 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
<!-- File: $Id: Bv9ARM-book.xml,v 1.126 2001/04/26 18:05:04 gson Exp $ -->
<!-- File: $Id: Bv9ARM-book.xml,v 1.127 2001/05/07 23:34:13 gson Exp $ -->
<book>
<title>BIND 9 Administrator Reference Manual</title>
......@@ -729,20 +729,33 @@ of a server.</para>
<variablelist>
<varlistentry><term><userinput>reload</userinput></term>
<listitem><para>Reload configuration file and zones.</para></listitem></varlistentry>
<listitem><para>Reload configuration file and zones.</para></listitem>
</varlistentry>
<varlistentry><term><userinput>reload <replaceable>zone</replaceable>
<optional><replaceable>class</replaceable>
<optional><replaceable>view</replaceable></optional></optional></userinput></term>
<listitem><para>Reload the given zone.</para></listitem></varlistentry>
<listitem><para>Reload the given zone.</para></listitem>
</varlistentry>
<varlistentry><term><userinput>refresh <replaceable>zone</replaceable>
<optional><replaceable>class</replaceable>
<optional><replaceable>view</replaceable></optional></optional></userinput></term>
<listitem><para>Schedule zone maintenance for the given zone.</para></listitem></varlistentry>
<listitem><para>Schedule zone maintenance for the given zone.</para></listitem>
</varlistentry>
<varlistentry><term><userinput>reconfig</userinput></term>
<listitem><para>Reload the configuration file and load new zones,
but do not reload existing zone files even if they have changed.
This is faster than a full <command>reload</command> when there
is a large number of zones because it avoids the need to examine the
modification times of the zones files.
</para></listitem>
</varlistentry>
<varlistentry><term><userinput>stats</userinput></term>
<listitem><para>Write server statistics to the statistics file.</para></listitem></varlistentry>
<listitem><para>Write server statistics to the statistics file.</para></listitem>
</varlistentry>
<varlistentry><term><userinput>querylog</userinput></term>
<listitem><para>Toggle query logging.</para></listitem></varlistentry>
......
......@@ -949,6 +949,25 @@ CLASS="replaceable"
><TT
CLASS="userinput"
><B
>reconfig</B
></TT
></DT
><DD
><P
>Reload the configuration file and load new zones,
but do not reload existing zone files even if they have changed.
This is faster than a full <B
CLASS="command"
>reload</B
> when there
is a large number of zones because it avoids the need to examine the
modification times of the zones files.
</P
></DD
><DT
><TT
CLASS="userinput"
><B
>stats</B
></TT
></DT
......@@ -1271,7 +1290,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN628"
NAME="AEN634"
>3.4.2. Signals</A
></H2
><P
......@@ -1284,7 +1303,7 @@ CLASS="command"
><DIV
CLASS="informaltable"
><A
NAME="AEN632"
NAME="AEN638"
></A
><P
></P
......
......@@ -88,7 +88,7 @@ HREF="Bv9ARM.ch04.html#incremental_zone_transfers"
></DT
><DT
>4.3. <A
HREF="Bv9ARM.ch04.html#AEN692"
HREF="Bv9ARM.ch04.html#AEN698"
>Split DNS</A
></DT
><DT
......@@ -98,12 +98,12 @@ HREF="Bv9ARM.ch04.html#tsig"
></DT
><DT
>4.5. <A
HREF="Bv9ARM.ch04.html#AEN852"
HREF="Bv9ARM.ch04.html#AEN858"
>TKEY</A
></DT
><DT
>4.6. <A
HREF="Bv9ARM.ch04.html#AEN867"
HREF="Bv9ARM.ch04.html#AEN873"
>SIG(0)</A
></DT
><DT
......@@ -113,7 +113,7 @@ HREF="Bv9ARM.ch04.html#DNSSEC"
></DT
><DT
>4.8. <A
HREF="Bv9ARM.ch04.html#AEN952"
HREF="Bv9ARM.ch04.html#AEN958"
>IPv6 Support in <SPAN
CLASS="acronym"
>BIND</SPAN
......@@ -274,7 +274,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="AEN692"
NAME="AEN698"
>4.3. Split DNS</A
></H1
><P
......@@ -672,7 +672,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN783"
NAME="AEN789"
>4.4.1. Generate Shared Keys for Each Pair of Hosts</A
></H2
><P
......@@ -690,7 +690,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN788"
NAME="AEN794"
>4.4.1.1. Automatic Generation</A
></H3
><P
......@@ -732,7 +732,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN799"
NAME="AEN805"
>4.4.1.2. Manual Generation</A
></H3
><P
......@@ -753,7 +753,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN804"
NAME="AEN810"
>4.4.2. Copying the Shared Secret to Both Machines</A
></H2
><P
......@@ -765,7 +765,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN807"
NAME="AEN813"
>4.4.3. Informing the Servers of the Key's Existence</A
></H2
><P
......@@ -813,7 +813,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN819"
NAME="AEN825"
>4.4.4. Instructing the Server to Use the Key</A
></H2
><P
......@@ -873,7 +873,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN835"
NAME="AEN841"
>4.4.5. TSIG Key Based Access Control</A
></H2
><P
......@@ -919,7 +919,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN848"
NAME="AEN854"
>4.4.6. Errors</A
></H2
><P
......@@ -948,7 +948,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="AEN852"
NAME="AEN858"
>4.5. TKEY</A
></H1
><P
......@@ -1014,7 +1014,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="AEN867"
NAME="AEN873"
>4.6. SIG(0)</A
></H1
><P
......@@ -1086,7 +1086,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN884"
NAME="AEN890"
>4.7.1. Generating Keys</A
></H2
><P
......@@ -1165,7 +1165,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN904"
NAME="AEN910"
>4.7.2. Creating a Keyset</A
></H2
><P
......@@ -1218,7 +1218,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN916"
NAME="AEN922"
>4.7.3. Signing the Child's Keyset</A
></H2
><P
......@@ -1268,7 +1268,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN929"
NAME="AEN935"
>4.7.4. Signing the Zone</A
></H2
><P
......@@ -1330,7 +1330,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN945"
NAME="AEN951"
>4.7.5. Configuring Servers</A
></H2
><P
......@@ -1357,7 +1357,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="AEN952"
NAME="AEN958"
>4.8. IPv6 Support in <SPAN
CLASS="acronym"
>BIND</SPAN
......@@ -1417,7 +1417,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN968"
NAME="AEN974"
>4.8.1. Address Lookups Using AAAA Records</A
></H2
><P
......@@ -1439,7 +1439,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN973"
NAME="AEN979"
>4.8.2. Address Lookups Using A6 Records</A
></H2
><P
......@@ -1459,7 +1459,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN977"
NAME="AEN983"
>4.8.2.1. A6 Chains</A
></H3
><P
......@@ -1505,7 +1505,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN988"
NAME="AEN994"
>4.8.2.2. A6 Records for DNS Servers</A
></H3
><P
......@@ -1535,7 +1535,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN994"
NAME="AEN1000"
>4.8.3. Address to Name Lookups Using Nibble Format</A
></H2
><P
......@@ -1566,7 +1566,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1001"
NAME="AEN1007"
>4.8.4. Address to Name Lookups Using Bitstring Format</A
></H2
><P
......@@ -1593,7 +1593,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1008"
NAME="AEN1014"
>4.8.5. Using DNAME for Delegation of IPv6 Reverse Addresses</A
></H2
><P
......
......@@ -81,7 +81,7 @@ CLASS="TOC"
></DT
><DT
>5.1. <A
HREF="Bv9ARM.ch05.html#AEN1028"
HREF="Bv9ARM.ch05.html#AEN1034"
>The Lightweight Resolver Library</A
></DT
><DT
......@@ -96,7 +96,7 @@ CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="AEN1028"
NAME="AEN1034"
>5.1. The Lightweight Resolver Library</A
></H1
><P
......
......@@ -91,7 +91,7 @@ HREF="Bv9ARM.ch06.html#Configuration_File_Grammar"
></DT
><DT
>6.3. <A
HREF="Bv9ARM.ch06.html#AEN3378"
HREF="Bv9ARM.ch06.html#AEN3384"
>Zone File</A
></DT
></DL
......@@ -145,7 +145,7 @@ file documentation:</P
><DIV
CLASS="informaltable"
><A
NAME="AEN1070"
NAME="AEN1076"
></A
><P
></P
......@@ -740,7 +740,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN1233"
NAME="AEN1239"
>6.1.1.1. Syntax</A
></H3
><PRE
......@@ -771,7 +771,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN1241"
NAME="AEN1247"
>6.1.1.2. Definition and Usage</A
></H3
><P
......@@ -882,7 +882,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1270"
NAME="AEN1276"
>6.1.2. Comment Syntax</A
></H2
><P
......@@ -901,7 +901,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN1275"
NAME="AEN1281"
>6.1.2.1. Syntax</A
></H3
><P
......@@ -933,7 +933,7 @@ CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN1284"
NAME="AEN1290"
>6.1.2.2. Definition and Usage</A
></H3
><P
......@@ -1043,7 +1043,7 @@ CLASS="acronym"
><DIV
CLASS="informaltable"
><A
NAME="AEN1308"
NAME="AEN1314"
></A
><P
></P
......@@ -1271,7 +1271,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1377"
NAME="AEN1383"
>6.2.1. <B
CLASS="command"
>acl</B
......@@ -1318,7 +1318,7 @@ CLASS="command"
><DIV
CLASS="informaltable"
><A
NAME="AEN1390"
NAME="AEN1396"
></A
><P
></P
......@@ -1416,7 +1416,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1419"
NAME="AEN1425"
>6.2.3. <B
CLASS="command"
>controls</B
......@@ -1455,7 +1455,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1428"
NAME="AEN1434"
>6.2.4. <B
CLASS="command"
>controls</B
......@@ -1560,7 +1560,7 @@ CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1454"
NAME="AEN1460"
>6.2.5. <B
CLASS="command"
>include</B
......@@ -1580,7 +1580,7 @@ CLASS="sect2"