]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
mark "cache-file" as ancient and remove all code implementing it
authorEvan Hunt <each@isc.org>
Wed, 15 Sep 2021 08:05:05 +0000 (01:05 -0700)
committerEvan Hunt <each@isc.org>
Thu, 16 Sep 2021 07:19:02 +0000 (00:19 -0700)
"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.

15 files changed:
CHANGES
bin/named/named.conf.rst
bin/named/named.rst
bin/named/server.c
doc/arm/reference.rst
doc/man/named.8in
doc/man/named.conf.5in
doc/misc/named.conf.rst
doc/misc/options
doc/misc/options.active
doc/misc/options.grammar.rst
lib/bind9/check.c
lib/dns/cache.c
lib/dns/include/dns/cache.h
lib/isccfg/namedconf.c

diff --git a/CHANGES b/CHANGES
index 254cdb04771d3ea2f4bbc66066f7776d270b1827..65c61c93ce674d8dbf944cf913b46b2c9f133224 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
 
index 2d02ede4617ce4884cbda92ce2c9108406459cd8..681d2262712e9616838e564c5c5c5be0b297ce15 100644 (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
index 813551a3716f6b2718ad33a8b12cb45b1d530a82..cd7becc840727228ccd305f2d1fa5b72457b6e4f 100644 (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
 ~~~~~~~
 
index 014abd21b284235a9c47e795e87daba36b33b2cb..ae48993b6046ccf3ad9f80b3149c5e8e1a9f37e5 100644 (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);
index c07a7a031a8a0a4251d7be4fde331c81704a7b82..b873f387b6dcceda57453925468fea98d9997579 100644 (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
index ae9dfa064094a2c9fbcd82cee2b80ea0ca681e4a..a54ec58d2829a6e472adc30485d2cef06e56bbae 100644 (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
index 3b35124e7a3f22cf792b27edc0db399a354cc29e..babba74558b348b117cfa5dbcfd985b2f0b4579f 100644 (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
index fcac8e6f19929b651b23de9f67a246dc5df882c1..c5829e0643920ed9e7a72cf05b0c74d3e210911b 100644 (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
index d765f806b6feb289700adefc1bd10784555c15bf..6bc93b7de12e2a466b4e1b39dfd76be480f61eaf 100644 (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
index b18ae01287d9d4cc460b2d0fb56eecb32ad622a0..5fc578fd6756ceacedd6bb5800bbb88d734725f0 100644 (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
index 575cc2e47f03be72c448518fa31a12c917e2e348..0d74ff0bfcaf0d36f638966cec44115eba5db14f 100644 (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
index eb3d465af5e1e9082e63b8647fdfd47d8dc8a67f..01ad26803e3a9fb8f3f0bc1ebf8fd94307710cfd 100644 (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) {
index 26af46d1a2a51b307349a69c7181a6b4145cfa29..579d3951310666669d263957fdccf9c00d223361 100644 (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));
index 22e94da9d5af45f843f07f4f68e440b100afcdd2..383eccf189703691b3fec1303b4dffee4d5faedf 100644 (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);
 /*%<
index 38e73d8caea1701ea1b2124d67887b2e44d971cc..54641699d19e03ddfbeaf0d9e140f7ab15d3d8f6 100644 (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 },