]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
noticed the default max-cache-size [RT #17515]
authorTatuya JINMEI 神明達哉 <jinmei@isc.org>
Tue, 22 Jan 2008 00:29:03 +0000 (00:29 +0000)
committerTatuya JINMEI 神明達哉 <jinmei@isc.org>
Tue, 22 Jan 2008 00:29:03 +0000 (00:29 +0000)
bin/named/config.c
bin/named/server.c
lib/isccfg/namedconf.c

index 3931da8fc8ea60a18ecc9d5ce04a57ca2296568f..29462106502f1ecd40e2abdf240b5470b8a253e0 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: config.c,v 1.82 2007/10/19 17:15:53 explorer Exp $ */
+/* $Id: config.c,v 1.83 2008/01/22 00:29:03 jinmei Exp $ */
 
 /*! \file */
 
@@ -129,7 +129,7 @@ options {\n\
        max-ncache-ttl 10800; /* 3 hours */\n\
        max-cache-ttl 604800; /* 1 week */\n\
        transfer-format many-answers;\n\
-       max-cache-size 32M;\n\
+#      max-cache-size default; /* set default in server.c */\n\
        check-names master fail;\n\
        check-names slave warn;\n\
        check-names response ignore;\n\
index db3c0f0db1f40ccd52654c09fd0fa9218a91df32..cd141ee77c35e313d6778a52386d5aa4f5298d50 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: server.c,v 1.499 2008/01/18 23:46:57 tbox Exp $ */
+/* $Id: server.c,v 1.500 2008/01/22 00:29:03 jinmei Exp $ */
 
 /*! \file */
 
@@ -222,6 +222,11 @@ static const struct {
        { NULL, ISC_FALSE }
 };
 
+/*%
+ * The default max-cache-size
+ */
+#define NS_MAXCACHESIZE_DEFAULT        33554432 /*%< Bytes.  33554432 = 32MB */
+
 static void
 fatal(const char *msg, isc_result_t result);
 
@@ -1179,11 +1184,21 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
 
        obj = NULL;
        result = ns_config_get(maps, "max-cache-size", &obj);
-       INSIST(result == ISC_R_SUCCESS);
-       if (cfg_obj_isstring(obj)) {
+       INSIST(result == ISC_R_SUCCESS || result == ISC_R_NOTFOUND);
+       if (result == ISC_R_NOTFOUND) {
+               max_cache_size = NS_MAXCACHESIZE_DEFAULT;
+               isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
+                             NS_LOGMODULE_SERVER, ISC_LOG_INFO,
+                             "default max-cache-size (%u) applies%s%s",
+                             max_cache_size, sep, viewname);
+       } else if (cfg_obj_isstring(obj)) {
                str = cfg_obj_asstring(obj);
-               INSIST(strcasecmp(str, "unlimited") == 0);
-               max_cache_size = ISC_UINT32_MAX;
+               INSIST(strcasecmp(str, "unlimited") == 0 ||
+                      strcasecmp(str, "default") == 0);
+               if (strcasecmp(str, "unlimited") == 0)
+                       max_cache_size = ISC_UINT32_MAX;
+               else
+                       max_cache_size = NS_MAXCACHESIZE_DEFAULT;
        } else {
                isc_resourcevalue_t value;
                value = cfg_obj_asuint64(obj);
index ee710c03b26beb8d49cc7decfefb3d0d86b39b26..0549518eb1011f6f3af98c31aa4c60c34743dc46 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: namedconf.c,v 1.83 2008/01/18 23:46:58 tbox Exp $ */
+/* $Id: namedconf.c,v 1.84 2008/01/22 00:29:03 jinmei Exp $ */
 
 /*! \file */
 
@@ -764,7 +764,7 @@ view_clauses[] = {
        { "max-ncache-ttl", &cfg_type_uint32, 0 },
        { "max-cache-ttl", &cfg_type_uint32, 0 },
        { "transfer-format", &cfg_type_transferformat, 0 },
-       { "max-cache-size", &cfg_type_sizenodefault, 0 },
+       { "max-cache-size", &cfg_type_size, 0 },
        { "check-names", &cfg_type_checknames, CFG_CLAUSEFLAG_MULTI },
        { "cache-file", &cfg_type_qstring, 0 },
        { "suppress-initial-notify", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI },