diff --git a/bin/named/server.c b/bin/named/server.c index 1c1c08eb7f..c1c7f0d4c8 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.275 2000/12/15 19:38:07 gson Exp $ */ +/* $Id: server.c,v 1.276 2000/12/15 21:11:38 gson Exp $ */ #include @@ -2414,8 +2414,8 @@ ns_server_dumpdb(ns_server_t *server) { view = ISC_LIST_NEXT(view, link)) { if (view->cachedb != NULL) - CHECKM(dns_view_dumpcachetostream(view, fp), - "could not dump cache"); + CHECKM(dns_view_dumpdbtostream(view, fp), + "could not dump view databases"); } cleanup: if (fp != NULL) diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index aae31e6179..5f30b7b3b7 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: view.h,v 1.58 2000/12/13 21:28:38 bwelling Exp $ */ +/* $Id: view.h,v 1.59 2000/12/15 21:11:36 gson Exp $ */ #ifndef DNS_VIEW_H #define DNS_VIEW_H 1 @@ -631,20 +631,37 @@ dns_view_dialup(dns_view_t *view); isc_result_t dns_view_dumpcache(dns_view_t *view); - -isc_result_t -dns_view_dumpcachetostream(dns_view_t *view, FILE *fp); /* - * Dump the cache to the specified cache file (if there is one) or stream. + * Dump the view's cache to the the view's cache file. * * Requires: * * 'view' is valid. * - * 'fp' is an open file. + * Returns: + * ISC_R_SUCCESS The cache was successfully dumped. + * ISC_R_IGNORE No cachefile was specified. + * others An error occurred (see dns_master_dump) + */ + +isc_result_t +dns_view_dumpdbtostream(dns_view_t *view, FILE *fp); +/* + * Dump the current state of the view 'view' to the stream 'fp' + * for purposes of analysis or debugging. + * + * Currently the dumped state includes the view's cache; in the future + * it may also include other state such as the address database. + * It will not not include authoritative data since it is voluminous and + * easily obtainable by other means. + * + * Requires: + * + * 'view' is valid. + * + * 'fp' refers to a file open for writing. * * Returns: - * * ISC_R_SUCCESS The cache was successfully dumped. * ISC_R_IGNORE No cachefile was specified. * others An error occurred (see dns_master_dump) diff --git a/lib/dns/view.c b/lib/dns/view.c index 294c2429ea..fedc758783 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: view.c,v 1.86 2000/12/12 21:33:14 bwelling Exp $ */ +/* $Id: view.c,v 1.87 2000/12/15 21:11:35 gson Exp $ */ #include @@ -1068,11 +1068,18 @@ dns_view_dumpcache(dns_view_t *view) { } isc_result_t -dns_view_dumpcachetostream(dns_view_t *view, FILE *fp) { +dns_view_dumpdbtostream(dns_view_t *view, FILE *fp) { + isc_result_t result; + REQUIRE(DNS_VIEW_VALID(view)); - return (dns_master_dumptostream(view->mctx, view->cachedb, NULL, - &dns_master_style_default, fp)); - + (void)fprintf(fp, ";\n; Cache dump of view '%s'\n;\n", view->name); + result = dns_master_dumptostream(view->mctx, view->cachedb, NULL, + &dns_master_style_explicitttl, fp); + if (result != ISC_R_SUCCESS) + return (result); +#ifdef notyet /* clean up adb dump format first */ + dns_adb_dump(view->adb, fp); +#endif + return (ISC_R_SUCCESS); } -