From dfceef7e68b56f6970dd2e8eea9980ad16bcc653 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Wed, 7 Feb 2001 00:50:44 +0000 Subject: [PATCH] rndc trace now takes an optional level parameter. --- bin/named/include/named/server.h | 8 +++++++- bin/named/omapi.c | 6 ++---- bin/named/server.c | 28 +++++++++++++++++++++++++++- bin/rndc/rndc.c | 3 ++- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h index 72cff16d6f..9484aea330 100644 --- a/bin/named/include/named/server.h +++ b/bin/named/include/named/server.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.h,v 1.50 2001/01/29 07:08:41 marka Exp $ */ +/* $Id: server.h,v 1.51 2001/02/07 00:50:43 bwelling Exp $ */ #ifndef NAMED_SERVER_H #define NAMED_SERVER_H 1 @@ -141,4 +141,10 @@ ns_server_dumpstats(ns_server_t *server); isc_result_t ns_server_dumpdb(ns_server_t *server); +/* + * Change or increment the server debug level. + */ +isc_result_t +ns_server_setdebuglevel(ns_server_t *server, char *args); + #endif /* NAMED_SERVER_H */ diff --git a/bin/named/omapi.c b/bin/named/omapi.c index 4ba3fc9f57..60e7d25ccd 100644 --- a/bin/named/omapi.c +++ b/bin/named/omapi.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: omapi.c,v 1.31 2001/02/06 23:57:13 bwelling Exp $ */ +/* $Id: omapi.c,v 1.32 2001/02/07 00:50:40 bwelling Exp $ */ /* * Principal Author: DCL @@ -114,9 +114,7 @@ control_setvalue(omapi_object_t *handle, omapi_string_t *name, ns_server_dumpdb(ns_g_server); result = ISC_R_SUCCESS; } else if (omapi_string_strcmp(name, NS_OMAPI_COMMAND_TRACE) == 0) { - ns_g_debuglevel++; - isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel); - result = ISC_R_SUCCESS; + result = ns_server_setdebuglevel(ns_g_server, args); } else if (omapi_string_strcmp(name, NS_OMAPI_COMMAND_NOTRACE) == 0) { ns_g_debuglevel = 0; isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel); diff --git a/bin/named/server.c b/bin/named/server.c index 8641a6993b..874d25ea3c 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.288 2001/02/01 21:29:41 marka Exp $ */ +/* $Id: server.c,v 1.289 2001/02/07 00:50:41 bwelling Exp $ */ #include @@ -2459,3 +2459,29 @@ ns_server_dumpdb(ns_server_t *server) { (void)isc_stdio_close(fp); return (result); } + +isc_result_t +ns_server_setdebuglevel(ns_server_t *server, char *args) { + char *ptr; + char *levelstr; + char *endp; + unsigned int newlevel; + + /* Skip the command name. */ + ptr = next_token(&args, " \t"); + if (ptr == NULL) + return (ISC_R_UNEXPECTEDEND); + + /* Look for the new level name. */ + levelstr = next_token(&args, " \t"); + if (levelstr == NULL) + ns_g_debuglevel++; + else { + newlevel = strtol(levelstr, &endp, 10); + if (*endp != '\0' || newlevel < 0 || newlevel > 99) + return (ISC_R_RANGE); + ns_g_debuglevel = newlevel; + } + isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel); + return (ISC_R_SUCCESS); +} diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index ad18ccff48..aeb73486c2 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rndc.c,v 1.39 2001/02/06 23:57:16 bwelling Exp $ */ +/* $Id: rndc.c,v 1.40 2001/02/07 00:50:44 bwelling Exp $ */ /* * Principal Author: DCL @@ -271,6 +271,7 @@ command is one of the following:\n\ stop Save pending updates to master files and stop the server.\n\ halt Stop the server without saving pending updates.\n\ trace Increment debugging level by one.\n\ + trace level Change the debugging level.\n\ notrace Set debugging level to 0.\n\ *status Display ps(1) status of named.\n\ *restart Restart the server.\n\