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.
+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.
* 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>
* 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)) {
* 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
*/
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.
*/
*/
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.
*/
* 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>
return (result);
}
-static void
+static isc_result_t
reload(ns_server_t *server) {
isc_result_t result;
CHECK(loadconfig(server));
"reloading zones failed: %s",
isc_result_totext(result));
}
- cleanup: ;
+ cleanup:
+ return (result);
}
static void
INSIST(task = server->task);
UNUSED(task);
- reload(server);
+ (void)reload(server);
LOCK(&server->reload_event_lock);
INSIST(server->reload_event == NULL);
* 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);
}
* 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)
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);
}
"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);
(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);
* 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
* 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().
*/
* 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);
/*
* 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>
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;
}
}
if (result == DNS_R_CONTINUE) {
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADING);
- result = ISC_R_SUCCESS;
goto cleanup;
}
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;
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));
}
}
* 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>
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
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