1139. [func] It is now possible to flush a given name from the
caches via 'rndc flushname name [view]'. [RT #2051]
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: control.c,v 1.8 2001/09/15 14:23:22 marka Exp $ */
|
||||
/* $Id: control.c,v 1.9 2001/11/27 04:06:08 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -110,6 +110,8 @@ ns_control_docommand(isccc_sexpr_t *message, isc_buffer_t *text) {
|
||||
result = ISC_R_SUCCESS;
|
||||
} else if (command_compare(command, NS_COMMAND_FLUSH)) {
|
||||
result = ns_server_flushcache(ns_g_server, command);
|
||||
} else if (command_compare(command, NS_COMMAND_FLUSHNAME)) {
|
||||
result = ns_server_flushname(ns_g_server, command);
|
||||
} else if (command_compare(command, NS_COMMAND_STATUS)) {
|
||||
result = ns_server_status(ns_g_server, text);
|
||||
} else {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: control.h,v 1.7 2001/09/15 14:23:25 marka Exp $ */
|
||||
/* $Id: control.h,v 1.8 2001/11/27 04:06:10 marka Exp $ */
|
||||
|
||||
#ifndef NAMED_CONTROL_H
|
||||
#define NAMED_CONTROL_H 1
|
||||
@@ -43,6 +43,7 @@
|
||||
#define NS_COMMAND_TRACE "trace"
|
||||
#define NS_COMMAND_NOTRACE "notrace"
|
||||
#define NS_COMMAND_FLUSH "flush"
|
||||
#define NS_COMMAND_FLUSHNAME "flushname"
|
||||
#define NS_COMMAND_STATUS "status"
|
||||
|
||||
isc_result_t
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: server.h,v 1.62 2001/11/20 01:15:00 gson Exp $ */
|
||||
/* $Id: server.h,v 1.63 2001/11/27 04:06:11 marka Exp $ */
|
||||
|
||||
#ifndef NAMED_SERVER_H
|
||||
#define NAMED_SERVER_H 1
|
||||
@@ -173,6 +173,12 @@ ns_server_setdebuglevel(ns_server_t *server, char *args);
|
||||
isc_result_t
|
||||
ns_server_flushcache(ns_server_t *server, char *args);
|
||||
|
||||
/*
|
||||
* Flush a particular name from the server's cache(s)
|
||||
*/
|
||||
isc_result_t
|
||||
ns_server_flushname(ns_server_t *server, char *args);
|
||||
|
||||
/*
|
||||
* Report the server's status.
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: server.c,v 1.363 2001/11/20 22:30:35 gson Exp $ */
|
||||
/* $Id: server.c,v 1.364 2001/11/27 04:06:07 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -2757,6 +2757,58 @@ ns_server_flushcache(ns_server_t *server, char *args) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
ns_server_flushname(ns_server_t *server, char *args) {
|
||||
char *ptr, *target, *viewname;
|
||||
dns_view_t *view;
|
||||
isc_boolean_t flushed = ISC_FALSE;
|
||||
isc_result_t result;
|
||||
isc_buffer_t b;
|
||||
dns_fixedname_t fixed;
|
||||
dns_name_t *name;
|
||||
|
||||
/* Skip the command name. */
|
||||
ptr = next_token(&args, " \t");
|
||||
if (ptr == NULL)
|
||||
return (ISC_R_UNEXPECTEDEND);
|
||||
|
||||
/* Find the domain name to flush. */
|
||||
target = next_token(&args, " \t");
|
||||
if (target == NULL)
|
||||
return (ISC_R_UNEXPECTEDEND);
|
||||
|
||||
isc_buffer_init(&b, target, strlen(target));
|
||||
isc_buffer_add(&b, strlen(target));
|
||||
dns_fixedname_init(&fixed);
|
||||
name = dns_fixedname_name(&fixed);
|
||||
result = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
/* Look for the view name. */
|
||||
viewname = next_token(&args, " \t");
|
||||
|
||||
result = isc_task_beginexclusive(server->task);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
flushed = ISC_TRUE;
|
||||
for (view = ISC_LIST_HEAD(server->viewlist);
|
||||
view != NULL;
|
||||
view = ISC_LIST_NEXT(view, link))
|
||||
{
|
||||
if (viewname != NULL && strcasecmp(viewname, view->name) != 0)
|
||||
continue;
|
||||
result = dns_view_flushname(view, name);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
flushed = ISC_FALSE;
|
||||
}
|
||||
if (flushed)
|
||||
result = ISC_R_SUCCESS;
|
||||
else
|
||||
result = ISC_R_FAILURE;
|
||||
isc_task_endexclusive(server->task);
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
ns_server_status(ns_server_t *server, isc_buffer_t *text) {
|
||||
int zonecount, xferrunning, xferdeferred, soaqueries;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: rndc.c,v 1.85 2001/11/14 23:54:29 bwelling Exp $ */
|
||||
/* $Id: rndc.c,v 1.86 2001/11/27 04:06:13 marka Exp $ */
|
||||
|
||||
/*
|
||||
* Principal Author: DCL
|
||||
@@ -106,6 +106,8 @@ command is one of the following:\n\
|
||||
notrace Set debugging level to 0.\n\
|
||||
flush Flushes all of the server's caches.\n\
|
||||
flush [view] Flushes the server's cache for a view.\n\
|
||||
flushname name [view]\n\
|
||||
Flush the give name from the server's cache(s)\n\
|
||||
status Display status of the server.\n\
|
||||
*restart Restart the server.\n\
|
||||
\n\
|
||||
|
||||
Reference in New Issue
Block a user