Commit 75ace660 authored by Mark Andrews's avatar Mark Andrews

1379. [func] 'rndc stats' now reports tcp and recursion quota

                        states.

1378.   [func]          Improved positive feedback for 'rndc {reload|refresh}.

1377.   [func]          dns_zone_load{new}() now reports if the zone was
                        loaded, queued for loading to up to date.

1376.   [func]          New function dns_zone_logc() to log to specified
                        category.
parent ba4aec8c
1379. [func] 'rndc stats' now reports tcp and recursion quota
states.
1378. [func] Improved positive feedback for 'rndc {reload|refresh}.
1377. [func] dns_zone_load{new}() now reports if the zone was
loaded, queued for loading to up to date.
1376. [func] New function dns_zone_logc() to log to specified
category.
1375. [func] 'rndc dumpdb' now dumps the adb cache along with the
data cache.
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: control.c,v 1.14 2002/09/08 18:34:03 explorer Exp $ */
/* $Id: control.c,v 1.15 2002/09/10 02:23:43 marka Exp $ */
#include <config.h>
......@@ -81,11 +81,11 @@ ns_control_docommand(isccc_sexpr_t *message, isc_buffer_t *text) {
* Compare the 'command' parameter against all known control commands.
*/
if (command_compare(command, NS_COMMAND_RELOAD)) {
result = ns_server_reloadcommand(ns_g_server, command);
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);
} else if (command_compare(command, NS_COMMAND_REFRESH)) {
result = ns_server_refreshcommand(ns_g_server, command);
result = ns_server_refreshcommand(ns_g_server, command, text);
} else if (command_compare(command, NS_COMMAND_RETRANSFER)) {
result = ns_server_retransfercommand(ns_g_server, command);
} else if (command_compare(command, NS_COMMAND_HALT)) {
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.h,v 1.68 2002/09/09 21:20:16 explorer Exp $ */
/* $Id: server.h,v 1.69 2002/09/10 02:23:44 marka Exp $ */
#ifndef NAMED_SERVER_H
#define NAMED_SERVER_H 1
......@@ -120,7 +120,7 @@ ns_server_flushonshutdown(ns_server_t *server, isc_boolean_t flush);
*/
isc_result_t
ns_server_reloadcommand(ns_server_t *server, char *args);
ns_server_reloadcommand(ns_server_t *server, char *args, isc_buffer_t *text);
/*
* Act on a "reload" command from the command channel.
*/
......@@ -132,7 +132,7 @@ ns_server_reconfigcommand(ns_server_t *server, char *args);
*/
isc_result_t
ns_server_refreshcommand(ns_server_t *server, char *args);
ns_server_refreshcommand(ns_server_t *server, char *args, isc_buffer_t *text);
/*
* Act on a "refresh" command from the command channel.
*/
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.386 2002/09/09 21:20:15 explorer Exp $ */
/* $Id: server.c,v 1.387 2002/09/10 02:23:44 marka Exp $ */
#include <config.h>
......@@ -2538,7 +2538,7 @@ loadconfig(ns_server_t *server) {
return (result);
}
static void
static isc_result_t
reload(ns_server_t *server) {
isc_result_t result;
CHECK(loadconfig(server));
......@@ -2550,7 +2550,8 @@ reload(ns_server_t *server) {
"reloading zones failed: %s",
isc_result_totext(result));
}
cleanup: ;
cleanup:
return (result);
}
static void
......@@ -2578,7 +2579,7 @@ ns_server_reload(isc_task_t *task, isc_event_t *event) {
INSIST(task = server->task);
UNUSED(task);
reload(server);
(void)reload(server);
LOCK(&server->reload_event_lock);
INSIST(server->reload_event == NULL);
......@@ -2707,24 +2708,48 @@ ns_server_retransfercommand(ns_server_t *server, char *args) {
* Act on a "reload" command from the command channel.
*/
isc_result_t
ns_server_reloadcommand(ns_server_t *server, char *args) {
ns_server_reloadcommand(ns_server_t *server, char *args, isc_buffer_t *text) {
isc_result_t result;
dns_zone_t *zone = NULL;
dns_zonetype_t type;
const char *msg = NULL;
result = zone_from_args(server, args, &zone);
if (result != ISC_R_SUCCESS)
return (result);
if (zone == NULL) {
reload(server);
result = reload(server);
if (result == ISC_R_SUCCESS)
msg = "server reload successful";
} else {
type = dns_zone_gettype(zone);
if (type == dns_zone_slave || type == dns_zone_stub)
if (type == dns_zone_slave || type == dns_zone_stub) {
dns_zone_refresh(zone);
else
msg = "zone refresh queued";
} else {
result = dns_zone_load(zone);
dns_zone_detach(&zone);
dns_zone_detach(&zone);
switch (result) {
case ISC_R_SUCCESS:
msg = "zone reload successful";
break;
case DNS_R_CONTINUE:
msg = "zone reload queued";
result = ISC_R_SUCCESS;
break;
case DNS_R_UPTODATE:
msg = "zone reload up-to-date";
result = ISC_R_SUCCESS;
break;
default:
/* failure message will be generated by rndc */
break;
}
}
}
if (msg != NULL && strlen(msg) < isc_buffer_availablelength(text))
isc_buffer_putmem(text, (const unsigned char *)msg,
strlen(msg) + 1);
return (result);
}
......@@ -2743,9 +2768,10 @@ ns_server_reconfigcommand(ns_server_t *server, char *args) {
* Act on a "refresh" command from the command channel.
*/
isc_result_t
ns_server_refreshcommand(ns_server_t *server, char *args) {
ns_server_refreshcommand(ns_server_t *server, char *args, isc_buffer_t *text) {
isc_result_t result;
dns_zone_t *zone = NULL;
const unsigned char msg[] = "zone refresh queued";
result = zone_from_args(server, args, &zone);
if (result != ISC_R_SUCCESS)
......@@ -2755,6 +2781,8 @@ ns_server_refreshcommand(ns_server_t *server, char *args) {
dns_zone_refresh(zone);
dns_zone_detach(&zone);
if (sizeof(msg) <= isc_buffer_availablelength(text))
isc_buffer_putmem(text, msg, sizeof(msg));
return (ISC_R_SUCCESS);
}
......@@ -3132,9 +3160,13 @@ ns_server_status(ns_server_t *server, isc_buffer_t *text) {
"xfers deferred: %d\n"
"soa queries in progress: %d\n"
"query logging is %s\n"
"recursive clients: %d/%d\n"
"tcp clients: %d/%d\n"
"server is up and running",
zonecount, ns_g_debuglevel, xferrunning, xferdeferred,
soaqueries, server->log_queries ? "ON" : "OFF");
soaqueries, server->log_queries ? "ON" : "OFF",
server->recursionquota.used, server->recursionquota.max,
server->tcpquota.used, server->tcpquota.max);
if (n >= isc_buffer_availablelength(text))
return (ISC_R_NOSPACE);
isc_buffer_add(text, n);
......@@ -3179,8 +3211,12 @@ ns_server_freeze(ns_server_t *server, isc_boolean_t freeze, char *args) {
(void)isc_file_remove(journal);
}
} else {
if (frozen)
if (frozen) {
result = dns_zone_load(zone);
if (result == DNS_R_CONTINUE ||
result == DNS_R_UPTODATE)
result = ISC_R_SUCCESS;
}
}
if (result == ISC_R_SUCCESS)
dns_zone_setupdatedisabled(zone, freeze);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.h,v 1.117 2002/07/29 06:58:46 marka Exp $ */
/* $Id: zone.h,v 1.118 2002/09/10 02:23:46 marka Exp $ */
#ifndef DNS_ZONE_H
#define DNS_ZONE_H 1
......@@ -232,6 +232,9 @@ dns_zone_loadnew(dns_zone_t *zone);
* Returns:
* ISC_R_UNEXPECTED
* ISC_R_SUCCESS
* DNS_R_CONTINUE Incremental load has been queued.
* DNS_R_UPTODATE The zone has already been loaded based on
* file system timestamps.
* DNS_R_BADZONE
* Any result value from dns_db_load().
*/
......@@ -1360,6 +1363,14 @@ dns_zone_log(dns_zone_t *zone, int level, const char *msg, ...)
* the message as applying to 'zone'.
*/
void
dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category, int level,
const char *msg, ...) ISC_FORMAT_PRINTF(4, 5);
/*
* Log the message 'msg...' at 'level', including text that identifies
* the message as applying to 'zone'.
*/
void
dns_zone_name(dns_zone_t *zone, char *buf, size_t len);
/*
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.c,v 1.376 2002/09/08 18:37:47 explorer Exp $ */
/* $Id: zone.c,v 1.377 2002/09/10 02:23:44 marka Exp $ */
#include <config.h>
......@@ -989,7 +989,7 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"skipping load: master file older "
"than last load");
result = ISC_R_SUCCESS;
result = DNS_R_UPTODATE;
goto cleanup;
}
}
......@@ -1038,7 +1038,6 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
if (result == DNS_R_CONTINUE) {
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADING);
result = ISC_R_SUCCESS;
goto cleanup;
}
......@@ -4749,6 +4748,25 @@ notify_log(dns_zone_t *zone, int level, const char *fmt, ...) {
level, "zone %s: %s", namebuf, message);
}
void
dns_zone_logc(dns_zone_t *zone, isc_logcategory_t *category,
int level, const char *fmt, ...) {
va_list ap;
char message[4096];
char namebuf[1024+32];
if (isc_log_wouldlog(dns_lctx, level) == ISC_FALSE)
return;
zone_tostr(zone, namebuf, sizeof(namebuf));
va_start(ap, fmt);
vsnprintf(message, sizeof(message), fmt, ap);
va_end(ap);
isc_log_write(dns_lctx, category, DNS_LOGMODULE_ZONE,
level, "zone %s: %s", namebuf, message);
}
void
dns_zone_log(dns_zone_t *zone, int level, const char *fmt, ...) {
va_list ap;
......@@ -5310,12 +5328,12 @@ queue_xfrin(dns_zone_t *zone) {
RWUNLOCK(&zmgr->rwlock, isc_rwlocktype_write);
if (result == ISC_R_QUOTA) {
dns_zone_log(zone, ISC_LOG_DEBUG(1),
"zone transfer deferred due to quota");
dns_zone_logc(zone, DNS_LOGCATEGORY_XFER_IN, ISC_LOG_INFO,
"zone transfer deferred due to quota");
} else if (result != ISC_R_SUCCESS) {
dns_zone_log(zone, ISC_LOG_ERROR,
"starting zone transfer: %s",
isc_result_totext(result));
dns_zone_logc(zone, DNS_LOGCATEGORY_XFER_IN, ISC_LOG_ERROR,
"starting zone transfer: %s",
isc_result_totext(result));
}
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zt.c,v 1.34 2001/11/12 19:05:39 gson Exp $ */
/* $Id: zt.c,v 1.35 2002/09/10 02:23:45 marka Exp $ */
#include <config.h>
......@@ -234,8 +234,12 @@ dns_zt_load(dns_zt_t *zt, isc_boolean_t stop) {
static isc_result_t
load(dns_zone_t *zone, void *uap) {
isc_result_t result;
UNUSED(uap);
return (dns_zone_load(zone));
result = dns_zone_load(zone);
if (result == DNS_R_CONTINUE || result == DNS_R_UPTODATE)
result = ISC_R_SUCCESS;
return (result);
}
isc_result_t
......@@ -252,8 +256,12 @@ dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop) {
static isc_result_t
loadnew(dns_zone_t *zone, void *uap) {
isc_result_t result;
UNUSED(uap);
return (dns_zone_loadnew(zone));
result = dns_zone_loadnew(zone);
if (result == DNS_R_CONTINUE || result == DNS_R_UPTODATE)
result = ISC_R_SUCCESS;
return (result);
}
isc_result_t
......
Markdown is supported
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