2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 23:25:38 +00:00

mark "cache-file" as ancient and remove all code implementing it

"cache-file" was already documented as intended for testing
purposes only and not to be used, so we can remove it without
waiting.  this commit marks the option as "ancient", and
removes all the documentation and implementing code, including
dns_cache_setfilename() and dns_cache_dump().

it also removes the documentation for the '-x cachefile`
parameter to named, which had already been removed, but the man
page was not updated at the time.
This commit is contained in:
Evan Hunt
2021-09-15 01:05:05 -07:00
parent a67d008ba5
commit a27860ba57
15 changed files with 8 additions and 203 deletions

View File

@@ -1,5 +1,6 @@
5717. [func] The "cache-file" option has been marked as
deprecated. [GL #2903]
5717. [func] The "cache-file" option, which was documented as
for testing purposes only and not to be used,
has been removed. [GL #2903]
5716. [placeholder]

View File

@@ -186,7 +186,6 @@ OPTIONS
avoid-v6-udp-ports { portrange; ... };
bindkeys-file quoted_string;
blackhole { address_match_element; ... };
cache-file quoted_string;// deprecated
catalog-zones { zone string [ default-masters [ port integer ]
[ dscp integer ] { ( remote-servers | ipv4_address [ port
integer ] | ipv6_address [ port integer ] ) [ key
@@ -620,7 +619,6 @@ VIEW
attach-cache string;
auth-nxdomain boolean;
auto-dnssec ( allow | maintain | off );
cache-file quoted_string;// deprecated
catalog-zones { zone string [ default-masters [ port integer ]
[ dscp integer ] { ( remote-servers | ipv4_address [ port
integer ] | ipv6_address [ port integer ] ) [ key

View File

@@ -29,7 +29,7 @@ named - Internet domain name server
Synopsis
~~~~~~~~
:program:`named` [ [**-4**] | [**-6**] ] [**-c** config-file] [**-d** debug-level] [**-D** string] [**-E** engine-name] [**-f**] [**-g**] [**-L** logfile] [**-M** option] [**-m** flag] [**-n** #cpus] [**-p** port] [**-s**] [**-S** #max-socks] [**-t** directory] [**-U** #listeners] [**-u** user] [**-v**] [**-V**] [**-X** lock-file] [**-x** cache-file]
:program:`named` [ [**-4**] | [**-6**] ] [**-c** config-file] [**-d** debug-level] [**-D** string] [**-E** engine-name] [**-f**] [**-g**] [**-L** logfile] [**-M** option] [**-m** flag] [**-n** #cpus] [**-p** port] [**-s**] [**-S** #max-socks] [**-t** directory] [**-U** #listeners] [**-u** user] [**-v**] [**-V**] [**-X** lock-file]
Description
~~~~~~~~~~~
@@ -189,14 +189,6 @@ Options
Use of this option overrides the ``lock-file`` option in
``named.conf``. If set to ``none``, the lock file check is disabled.
``-x cache-file``
This option loads data from ``cache-file`` into the cache of the default view.
.. warning::
This option must not be used in normal operations. It is only of interest to BIND 9
developers and may be removed or changed in a future release.
Signals
~~~~~~~

View File

@@ -4052,7 +4052,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
isc_mem_t *cmctx = NULL, *hmctx = NULL;
dns_dispatch_t *dispatch4 = NULL;
dns_dispatch_t *dispatch6 = NULL;
bool reused_cache = false;
bool shared_cache = false;
int i = 0, j = 0, k = 0;
const char *str;
@@ -4648,7 +4647,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
NAMED_LOGMODULE_SERVER,
ISC_LOG_DEBUG(3),
"reusing existing cache");
reused_cache = true;
dns_cache_attach(pview->cache, &cache);
}
dns_view_getresstats(pview, &resstats);
@@ -4693,19 +4691,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
}
dns_view_setcache(view, cache, shared_cache);
/*
* cache-file cannot be inherited if views are present, but this
* should be caught by the configuration checking stage.
*/
obj = NULL;
result = named_config_get(maps, "cache-file", &obj);
if (result == ISC_R_SUCCESS && strcmp(view->name, "_bind") != 0) {
CHECK(dns_cache_setfilename(cache, cfg_obj_asstring(obj)));
if (!reused_cache && !shared_cache) {
CHECK(dns_cache_load(cache));
}
}
dns_cache_setcachesize(cache, max_cache_size);
dns_cache_setservestalettl(cache, max_stale_ttl);
dns_cache_setservestalerefresh(cache, stale_refresh_time);

View File

@@ -1204,9 +1204,6 @@ default is used.
working directory. In most cases, the ``key_name`` should be the
server's host name.
``cache-file``
This is for testing only. Do not use.
``dump-file``
This is the pathname of the file the server dumps the database to, when
instructed to do so with ``rndc dumpdb``. If not specified, the

View File

@@ -32,7 +32,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
..
.SH SYNOPSIS
.sp
\fBnamed\fP [ [\fB\-4\fP] | [\fB\-6\fP] ] [\fB\-c\fP config\-file] [\fB\-d\fP debug\-level] [\fB\-D\fP string] [\fB\-E\fP engine\-name] [\fB\-f\fP] [\fB\-g\fP] [\fB\-L\fP logfile] [\fB\-M\fP option] [\fB\-m\fP flag] [\fB\-n\fP #cpus] [\fB\-p\fP port] [\fB\-s\fP] [\fB\-S\fP #max\-socks] [\fB\-t\fP directory] [\fB\-U\fP #listeners] [\fB\-u\fP user] [\fB\-v\fP] [\fB\-V\fP] [\fB\-X\fP lock\-file] [\fB\-x\fP cache\-file]
\fBnamed\fP [ [\fB\-4\fP] | [\fB\-6\fP] ] [\fB\-c\fP config\-file] [\fB\-d\fP debug\-level] [\fB\-D\fP string] [\fB\-E\fP engine\-name] [\fB\-f\fP] [\fB\-g\fP] [\fB\-L\fP logfile] [\fB\-M\fP option] [\fB\-m\fP flag] [\fB\-n\fP #cpus] [\fB\-p\fP port] [\fB\-s\fP] [\fB\-S\fP #max\-socks] [\fB\-t\fP directory] [\fB\-U\fP #listeners] [\fB\-u\fP user] [\fB\-v\fP] [\fB\-V\fP] [\fB\-X\fP lock\-file]
.SH DESCRIPTION
.sp
\fBnamed\fP is a Domain Name System (DNS) server, part of the BIND 9
@@ -208,17 +208,6 @@ This option acquires a lock on the specified file at runtime; this helps to
prevent duplicate \fBnamed\fP instances from running simultaneously.
Use of this option overrides the \fBlock\-file\fP option in
\fBnamed.conf\fP\&. If set to \fBnone\fP, the lock file check is disabled.
.TP
.B \fB\-x cache\-file\fP
This option loads data from \fBcache\-file\fP into the cache of the default view.
.UNINDENT
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
This option must not be used in normal operations. It is only of interest to BIND 9
developers and may be removed or changed in a future release.
.UNINDENT
.UNINDENT
.SH SIGNALS
.sp

View File

@@ -253,7 +253,6 @@ options {
avoid\-v6\-udp\-ports { portrange; ... };
bindkeys\-file quoted_string;
blackhole { address_match_element; ... };
cache\-file quoted_string;
catalog\-zones { zone string [ default\-masters [ port integer ]
[ dscp integer ] { ( remote\-servers | ipv4_address [ port
integer ] | ipv6_address [ port integer ] ) [ key
@@ -723,7 +722,6 @@ view string [ class ] {
attach\-cache string;
auth\-nxdomain boolean;
auto\-dnssec ( allow | maintain | off );
cache\-file quoted_string;
catalog\-zones { zone string [ default\-masters [ port integer ]
[ dscp integer ] { ( remote\-servers | ipv4_address [ port
integer ] | ipv6_address [ port integer ] ) [ key

View File

@@ -180,7 +180,6 @@ OPTIONS
avoid-v6-udp-ports { portrange; ... };
bindkeys-file quoted_string;
blackhole { address_match_element; ... };
cache-file quoted_string;
catalog-zones { zone string [ default-masters [ port integer ]
[ dscp integer ] { ( masters | ipv4_address [ port
integer ] | ipv6_address [ port integer ] ) [ key
@@ -558,7 +557,6 @@ VIEW
attach-cache string;
auth-nxdomain boolean; // default changed
auto-dnssec ( allow | maintain | off );
cache-file quoted_string;
catalog-zones { zone string [ default-masters [ port integer ]
[ dscp integer ] { ( masters | ipv4_address [ port
integer ] | ipv6_address [ port integer ] ) [ key

View File

@@ -110,7 +110,6 @@ options {
avoid-v6-udp-ports { <portrange>; ... };
bindkeys-file <quoted_string>;
blackhole { <address_match_element>; ... };
cache-file <quoted_string>; // deprecated
catalog-zones { zone <string> [ default-masters [ port <integer> ]
[ dscp <integer> ] { ( <remote-servers> | <ipv4_address> [ port
<integer> ] | <ipv6_address> [ port <integer> ] ) [ key
@@ -499,7 +498,6 @@ view <string> [ <class> ] {
attach-cache <string>;
auth-nxdomain <boolean>;
auto-dnssec ( allow | maintain | off );
cache-file <quoted_string>; // deprecated
catalog-zones { zone <string> [ default-masters [ port <integer> ]
[ dscp <integer> ] { ( <remote-servers> | <ipv4_address> [ port
<integer> ] | <ipv6_address> [ port <integer> ] ) [ key

View File

@@ -109,7 +109,6 @@ options {
avoid-v6-udp-ports { <portrange>; ... };
bindkeys-file <quoted_string>;
blackhole { <address_match_element>; ... };
cache-file <quoted_string>; // deprecated
catalog-zones { zone <string> [ default-masters [ port <integer> ]
[ dscp <integer> ] { ( <remote-servers> | <ipv4_address> [ port
<integer> ] | <ipv6_address> [ port <integer> ] ) [ key
@@ -496,7 +495,6 @@ view <string> [ <class> ] {
attach-cache <string>;
auth-nxdomain <boolean>;
auto-dnssec ( allow | maintain | off );
cache-file <quoted_string>; // deprecated
catalog-zones { zone <string> [ default-masters [ port <integer> ]
[ dscp <integer> ] { ( <remote-servers> | <ipv4_address> [ port
<integer> ] | <ipv6_address> [ port <integer> ] ) [ key

View File

@@ -29,7 +29,6 @@
avoid-v6-udp-ports { <portrange>; ... };
bindkeys-file <quoted_string>;
blackhole { <address_match_element>; ... };
cache-file <quoted_string>; // deprecated
catalog-zones { zone <string> [ default-masters [ port <integer> ]
[ dscp <integer> ] { ( <remote-servers> | <ipv4_address> [ port
<integer> ] | <ipv6_address> [ port <integer> ] ) [ key

View File

@@ -5493,7 +5493,6 @@ bind9_check_namedconf(const cfg_obj_t *config, bool check_plugins,
const cfg_obj_t *options = NULL;
const cfg_obj_t *views = NULL;
const cfg_obj_t *acls = NULL;
const cfg_obj_t *obj = NULL;
const cfg_listelt_t *velement;
isc_result_t result = ISC_R_SUCCESS;
isc_result_t tresult;
@@ -5676,17 +5675,6 @@ bind9_check_namedconf(const cfg_obj_t *config, bool check_plugins,
}
}
if (views != NULL && options != NULL) {
obj = NULL;
tresult = cfg_map_get(options, "cache-file", &obj);
if (tresult == ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"'cache-file' cannot be a global "
"option if views are present");
result = ISC_R_FAILURE;
}
}
cfg_map_get(config, "acl", &acls);
if (acls != NULL) {

View File

@@ -126,7 +126,6 @@ struct dns_cache {
/* Unlocked. */
unsigned int magic;
isc_mutex_t lock;
isc_mutex_t filelock;
isc_mem_t *mctx; /* Main cache memory */
isc_mem_t *hmctx; /* Heap memory */
char *name;
@@ -144,10 +143,6 @@ struct dns_cache {
dns_ttl_t serve_stale_ttl;
dns_ttl_t serve_stale_refresh;
isc_stats_t *stats;
/* Locked by 'filelock'. */
char *filename;
/* Access to the on-disk cache file is also locked by 'filelock'. */
};
/***
@@ -210,7 +205,6 @@ dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr,
}
isc_mutex_init(&cache->lock);
isc_mutex_init(&cache->filelock);
isc_refcount_init(&cache->references, 1);
isc_refcount_init(&cache->live_tasks, 1);
@@ -221,7 +215,7 @@ dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr,
result = isc_stats_create(cmctx, &cache->stats,
dns_cachestatscounter_max);
if (result != ISC_R_SUCCESS) {
goto cleanup_filelock;
goto cleanup_lock;
}
cache->db_type = isc_mem_strdup(cmctx, db_type);
@@ -273,8 +267,6 @@ dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr,
isc_task_detach(&dbtask);
}
cache->filename = NULL;
cache->magic = CACHE_MAGIC;
/*
@@ -312,9 +304,8 @@ cleanup_dbargv:
cache->db_argc * sizeof(char *));
}
isc_mem_free(cmctx, cache->db_type);
cleanup_filelock:
isc_mutex_destroy(&cache->filelock);
isc_stats_detach(&cache->stats);
cleanup_lock:
isc_mutex_destroy(&cache->lock);
if (cache->name != NULL) {
isc_mem_free(cmctx, cache->name);
@@ -351,11 +342,6 @@ cache_free(dns_cache_t *cache) {
isc_mutex_destroy(&cache->cleaner.lock);
if (cache->filename) {
isc_mem_free(cache->mctx, cache->filename);
cache->filename = NULL;
}
if (cache->db != NULL) {
dns_db_detach(&cache->db);
}
@@ -391,7 +377,6 @@ cache_free(dns_cache_t *cache) {
}
isc_mutex_destroy(&cache->lock);
isc_mutex_destroy(&cache->filelock);
cache->magic = 0;
isc_mem_detach(&cache->hmctx);
@@ -419,17 +404,6 @@ dns_cache_detach(dns_cache_t **cachep) {
if (isc_refcount_decrement(&cache->references) == 1) {
cache->cleaner.overmem = false;
/*
* When the cache is shut down, dump it to a file if one is
* specified.
*/
isc_result_t result = dns_cache_dump(cache);
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_CACHE, ISC_LOG_WARNING,
"error dumping cache: %s ",
isc_result_totext(result));
}
/*
* If the cleaner task exists, let it free the cache.
@@ -453,61 +427,6 @@ dns_cache_attachdb(dns_cache_t *cache, dns_db_t **dbp) {
UNLOCK(&cache->lock);
}
isc_result_t
dns_cache_setfilename(dns_cache_t *cache, const char *filename) {
char *newname;
REQUIRE(VALID_CACHE(cache));
REQUIRE(filename != NULL);
newname = isc_mem_strdup(cache->mctx, filename);
LOCK(&cache->filelock);
if (cache->filename) {
isc_mem_free(cache->mctx, cache->filename);
}
cache->filename = newname;
UNLOCK(&cache->filelock);
return (ISC_R_SUCCESS);
}
isc_result_t
dns_cache_load(dns_cache_t *cache) {
isc_result_t result;
REQUIRE(VALID_CACHE(cache));
if (cache->filename == NULL) {
return (ISC_R_SUCCESS);
}
LOCK(&cache->filelock);
result = dns_db_load(cache->db, cache->filename, dns_masterformat_text,
0);
UNLOCK(&cache->filelock);
return (result);
}
isc_result_t
dns_cache_dump(dns_cache_t *cache) {
isc_result_t result;
REQUIRE(VALID_CACHE(cache));
if (cache->filename == NULL) {
return (ISC_R_SUCCESS);
}
LOCK(&cache->filelock);
result = dns_master_dump(cache->mctx, cache->db, NULL,
&dns_master_style_cache, cache->filename,
dns_masterformat_text, NULL);
UNLOCK(&cache->filelock);
return (result);
}
const char *
dns_cache_getname(dns_cache_t *cache) {
REQUIRE(VALID_CACHE(cache));

View File

@@ -153,61 +153,6 @@ dns_cache_attachdb(dns_cache_t *cache, dns_db_t **dbp);
*\li *dbp is attached to the database.
*/
isc_result_t
dns_cache_setfilename(dns_cache_t *cache, const char *filename);
/*%<
* If 'filename' is non-NULL, make the cache persistent.
* The cache's data will be stored in the given file.
* If 'filename' is NULL, make the cache non-persistent.
* Files that are no longer used are not unlinked automatically.
*
* Returns:
*\li #ISC_R_SUCCESS
*\li #ISC_R_NOMEMORY
*\li Various file-related failures
*/
isc_result_t
dns_cache_load(dns_cache_t *cache);
/*%<
* If the cache has a file name, load the cache contents from the file.
* Previous cache contents are not discarded.
* If no file name has been set, do nothing and return success.
*
* MT:
*\li Multiple simultaneous attempts to load or dump the cache
* will be serialized with respect to one another, but
* the cache may be read and updated while the dump is
* in progress. Updates performed during loading
* may or may not be preserved, and reads may return
* either the old or the newly loaded data.
*
* Returns:
*
*\li #ISC_R_SUCCESS
* \li Various failures depending on the database implementation type
*/
isc_result_t
dns_cache_dump(dns_cache_t *cache);
/*%<
* If the cache has a file name, write the cache contents to disk,
* overwriting any preexisting file. If no file name has been set,
* do nothing and return success.
*
* MT:
*\li Multiple simultaneous attempts to load or dump the cache
* will be serialized with respect to one another, but
* the cache may be read and updated while the dump is
* in progress. Updates performed during the dump may
* or may not be reflected in the dumped file.
*
* Returns:
*
*\li #ISC_R_SUCCESS
* \li Various failures depending on the database implementation type
*/
isc_result_t
dns_cache_clean(dns_cache_t *cache, isc_stdtime_t now);
/*%<

View File

@@ -1990,7 +1990,7 @@ static cfg_clausedef_t view_clauses[] = {
{ "allow-v6-synthesis", NULL, CFG_CLAUSEFLAG_ANCIENT },
{ "attach-cache", &cfg_type_astring, 0 },
{ "auth-nxdomain", &cfg_type_boolean, 0 },
{ "cache-file", &cfg_type_qstring, CFG_CLAUSEFLAG_DEPRECATED },
{ "cache-file", &cfg_type_qstring, CFG_CLAUSEFLAG_ANCIENT },
{ "catalog-zones", &cfg_type_catz, 0 },
{ "check-names", &cfg_type_checknames, CFG_CLAUSEFLAG_MULTI },
{ "cleaning-interval", NULL, CFG_CLAUSEFLAG_ANCIENT },