]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[v9_9] accept >4g max-{,a}cache-size
authorEvan Hunt <each@isc.org>
Thu, 28 Feb 2013 17:36:50 +0000 (09:36 -0800)
committerEvan Hunt <each@isc.org>
Thu, 28 Feb 2013 17:36:50 +0000 (09:36 -0800)
3505. [bug] When setting "max-cache-size" and "max-acache-size",
larger values than 4 gigabytes could not be set
explicitly, though larger sizes were available
when setting cache size to 0. This has been
corrected; the full range is now available.
[RT #32358]
(cherry picked from commit 2a184ff86544cc67c36e2ce6bb3ddb5ac44684b8)

CHANGES
bin/named/server.c
bin/tests/system/checkconf/good.conf
doc/arm/Bv9ARM-book.xml
lib/dns/acache.c
lib/dns/adb.c
lib/dns/cache.c
lib/dns/include/dns/acache.h
lib/dns/include/dns/adb.h
lib/dns/include/dns/cache.h

diff --git a/CHANGES b/CHANGES
index bebe0cd913605fbd5948fd49996b47c1df666923..7aaf1acae29def310eb9640adcef1dab59ad3d71 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,10 @@
+3505.  [bug]           When setting "max-cache-size" and "max-acache-size",
+                       larger values than 4 gigabytes could not be set
+                       explicitly, though larger sizes were available
+                       when setting cache size to 0. This has been
+                       corrected; the full range is now available.
+                       [RT #32358]
+
 3503.  [doc]           Clarify size_spec syntax. [RT #32449]
 
 3501.  [func]          zone-statistics now takes three options: full,
index 1688fb30f75b4395cd3e778f7e55dca6d08fae91..057f19562519e62b81dc9fb7f65b5beb662cf1a9 100644 (file)
@@ -1399,7 +1399,7 @@ static isc_boolean_t
 cache_sharable(dns_view_t *originview, dns_view_t *view,
               isc_boolean_t new_zero_no_soattl,
               unsigned int new_cleaning_interval,
-              isc_uint32_t new_max_cache_size)
+              isc_uint64_t new_max_cache_size)
 {
        /*
         * If the cache cannot even reused for the same view, it cannot be
@@ -1666,10 +1666,10 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
        in_port_t port;
        dns_cache_t *cache = NULL;
        isc_result_t result;
-       isc_uint32_t max_adb_size;
        unsigned int cleaning_interval;
-       isc_uint32_t max_cache_size;
-       isc_uint32_t max_acache_size;
+       size_t max_cache_size;
+       size_t max_acache_size;
+       size_t max_adb_size;
        isc_uint32_t lame_ttl;
        dns_tsig_keyring_t *ring = NULL;
        dns_view_t *pview = NULL;       /* Production view */
@@ -1775,18 +1775,18 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
                        max_acache_size = ISC_UINT32_MAX;
                } else {
                        isc_resourcevalue_t value;
-
                        value = cfg_obj_asuint64(obj);
-                       if (value > ISC_UINT32_MAX) {
-                               cfg_obj_log(obj, ns_g_lctx, ISC_LOG_ERROR,
+                       if (value > SIZE_MAX) {
+                               cfg_obj_log(obj, ns_g_lctx,
+                                           ISC_LOG_WARNING,
                                            "'max-acache-size "
-                                           "%" ISC_PRINT_QUADFORMAT
-                                           "d' is too large",
-                                           value);
-                               result = ISC_R_RANGE;
-                               goto cleanup;
+                                           "%" ISC_PRINT_QUADFORMAT "u' "
+                                           "is too large for this "
+                                           "system; reducing to %lu",
+                                           value, SIZE_MAX);
+                               value = SIZE_MAX;
                        }
-                       max_acache_size = (isc_uint32_t)value;
+                       max_cache_size = (size_t) value;
                }
                dns_acache_setcachesize(view->acache, max_acache_size);
        }
@@ -1973,15 +1973,17 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
        } else {
                isc_resourcevalue_t value;
                value = cfg_obj_asuint64(obj);
-               if (value > ISC_UINT32_MAX) {
-                       cfg_obj_log(obj, ns_g_lctx, ISC_LOG_ERROR,
+               if (value > SIZE_MAX) {
+                       cfg_obj_log(obj, ns_g_lctx,
+                                   ISC_LOG_WARNING,
                                    "'max-cache-size "
-                                   "%" ISC_PRINT_QUADFORMAT "d' is too large",
-                                   value);
-                       result = ISC_R_RANGE;
-                       goto cleanup;
+                                   "%" ISC_PRINT_QUADFORMAT "u' "
+                                   "is too large for this "
+                                   "system; reducing to %lu",
+                                   value, SIZE_MAX);
+                       value = SIZE_MAX;
                }
-               max_cache_size = (isc_uint32_t)value;
+               max_cache_size = (size_t) value;
        }
 
        /* Check-names. */
index b4b439a9ca9757c13564b3bcd9e4c52c3c0113e3..5444fdde0a9e81dac72a01c8ea808d68de4c1510 100644 (file)
@@ -66,6 +66,7 @@ options {
        serial-queries 10;
        serial-query-rate 100;
        server-id none;
+       max-cache-size 20000000000000;
        zone-statistics none;
 };
 view "first" {
index 391c18eb99ffbd540f6c62f1eaf69230dc833f8c..e61aea936e6a1ba2fcb7e76bf436d2b23e67123c 100644 (file)
@@ -8259,8 +8259,10 @@ avoid-v6-udp-ports { 40000; range 50000 60000; };
                   approaches
                   the specified size, some of the oldest transactions in the
                   journal
-                  will be automatically removed.  The default is
-                  <literal>unlimited</literal>.
+                  will be automatically removed.  The largest permitted
+                  value is 2 gigabytes. The default is
+                  <literal>unlimited</literal>, which also
+                  means 2 gigabytes.
                   This may also be set on a per-zone basis.
                 </para>
               </listitem>
index 702fb98457793656335ef536b962de322df0601b..433db2cbf5439c692a19d99b66f495f0cd65ca20 100644 (file)
@@ -1769,9 +1769,8 @@ dns_acache_setcleaninginterval(dns_acache_t *acache, unsigned int t) {
  * function for more details about the logic.
  */
 void
-dns_acache_setcachesize(dns_acache_t *acache, isc_uint32_t size) {
-       isc_uint32_t lowater;
-       isc_uint32_t hiwater;
+dns_acache_setcachesize(dns_acache_t *acache, size_t size) {
+       size_t hiwater, lowater;
 
        REQUIRE(DNS_ACACHE_VALID(acache));
 
index 8028b692d4ac22e94c39410db5072941672dcd37..da1d9a08c3cb7849584bbbffbb5f3d974c1d8337 100644 (file)
@@ -4128,9 +4128,8 @@ water(void *arg, int mark) {
 }
 
 void
-dns_adb_setadbsize(dns_adb_t *adb, isc_uint32_t size) {
-       isc_uint32_t hiwater;
-       isc_uint32_t lowater;
+dns_adb_setadbsize(dns_adb_t *adb, size_t size) {
+       size_t hiwater, lowater;
 
        INSIST(DNS_ADB_VALID(adb));
 
index 7ba944b7bc133a3803421cdfa029e313c2092332..7b584c3a7d07f0c07cbde596fb60a2cb8e26cbb5 100644 (file)
@@ -136,7 +136,7 @@ struct dns_cache {
        char                    *db_type;
        int                     db_argc;
        char                    **db_argv;
-       isc_uint32_t            size;
+       size_t                  size;
 
        /* Locked by 'filelock'. */
        char                    *filename;
@@ -1028,9 +1028,8 @@ water(void *arg, int mark) {
 }
 
 void
-dns_cache_setcachesize(dns_cache_t *cache, isc_uint32_t size) {
-       isc_uint32_t lowater;
-       isc_uint32_t hiwater;
+dns_cache_setcachesize(dns_cache_t *cache, size_t size) {
+       size_t hiwater, lowater;
 
        REQUIRE(VALID_CACHE(cache));
 
@@ -1068,9 +1067,9 @@ dns_cache_setcachesize(dns_cache_t *cache, isc_uint32_t size) {
                isc_mem_setwater(cache->mctx, water, cache, hiwater, lowater);
 }
 
-isc_uint32_t
+size_t
 dns_cache_getcachesize(dns_cache_t *cache) {
-       isc_uint32_t size;
+       size_t size;
 
        REQUIRE(VALID_CACHE(cache));
 
index 28990c2aab0c249d3c48154441e012d19d7a5240..754ef9f8a7f509c515e5a7c0ead2f92c5d20da85 100644 (file)
@@ -238,7 +238,7 @@ dns_acache_setcleaninginterval(dns_acache_t *acache, unsigned int t);
  */
 
 void
-dns_acache_setcachesize(dns_acache_t *acache, isc_uint32_t size);
+dns_acache_setcachesize(dns_acache_t *acache, size_t size);
 /*
  * Set the maximum additional cache size.  0 means unlimited.
  */
index d3a243b80fcab09f4526953a0458e17dfe68926c..267ae83d554b31701727527382ee02c75722d02a 100644 (file)
@@ -607,7 +607,7 @@ dns_adb_flush(dns_adb_t *adb);
  */
 
 void
-dns_adb_setadbsize(dns_adb_t *adb, isc_uint32_t size);
+dns_adb_setadbsize(dns_adb_t *adb, size_t size);
 /*%<
  * Set a target memory size.  If memory usage exceeds the target
  * size entries will be removed before they would have expired on
index 419111b930b558245443a4aec579d74237836089..6f8081d811908a242d1be5f5004741cb31777601 100644 (file)
@@ -245,12 +245,6 @@ dns_cache_getcleaninginterval(dns_cache_t *cache);
  * Get the periodic cache cleaning interval to 'interval' seconds.
  */
 
-isc_uint32_t
-dns_cache_getcachesize(dns_cache_t *cache);
-/*%<
- * Get the maximum cache size.
- */
-
 const char *
 dns_cache_getname(dns_cache_t *cache);
 /*%<
@@ -258,12 +252,12 @@ dns_cache_getname(dns_cache_t *cache);
  */
 
 void
-dns_cache_setcachesize(dns_cache_t *cache, isc_uint32_t size);
+dns_cache_setcachesize(dns_cache_t *cache, size_t size);
 /*%<
  * Set the maximum cache size.  0 means unlimited.
  */
 
-isc_uint32_t
+size_t
 dns_cache_getcachesize(dns_cache_t *cache);
 /*%<
  * Get the maximum cache size.