From 95c5f1d17b09e06a09ebdfa331e4ff04f06ffd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatuya=20JINMEI=20=E7=A5=9E=E6=98=8E=E9=81=94=E5=93=89?= Date: Tue, 22 Jan 2008 00:29:03 +0000 Subject: [PATCH] noticed the default max-cache-size [RT #17515] --- bin/named/config.c | 4 ++-- bin/named/server.c | 25 ++++++++++++++++++++----- lib/isccfg/namedconf.c | 4 ++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/bin/named/config.c b/bin/named/config.c index 3931da8fc8..2946210650 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -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\ diff --git a/bin/named/server.c b/bin/named/server.c index db3c0f0db1..cd141ee77c 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -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); diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index ee710c03b2..0549518eb1 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -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 },