mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 22:45:39 +00:00
[master] accept >4g max-{,a}cache-size
3506. [func] When setting "max-cache-size" and "max-acache-size", the keyword "unlimited" is no longer defined as equal to 4 gigabytes (except on 32-bit platforms); it means literally unlimited. [RT #32358] 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]
This commit is contained in:
12
CHANGES
12
CHANGES
@@ -1,3 +1,15 @@
|
|||||||
|
3506. [func] When setting "max-cache-size" and "max-acache-size",
|
||||||
|
the keyword "unlimited" is no longer defined as equal
|
||||||
|
to 4 gigabytes (except on 32-bit platforms); it
|
||||||
|
means literally unlimited. [RT #32358]
|
||||||
|
|
||||||
|
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]
|
||||||
|
|
||||||
3504. [func] Add support for ACLs based on geographic location,
|
3504. [func] Add support for ACLs based on geographic location,
|
||||||
using MaxMind GeoIP databases. Based on code
|
using MaxMind GeoIP databases. Based on code
|
||||||
contributed by Ken Brownfield <kb@slide.com>.
|
contributed by Ken Brownfield <kb@slide.com>.
|
||||||
|
@@ -1446,7 +1446,7 @@ static isc_boolean_t
|
|||||||
cache_sharable(dns_view_t *originview, dns_view_t *view,
|
cache_sharable(dns_view_t *originview, dns_view_t *view,
|
||||||
isc_boolean_t new_zero_no_soattl,
|
isc_boolean_t new_zero_no_soattl,
|
||||||
unsigned int new_cleaning_interval,
|
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
|
* If the cache cannot even reused for the same view, it cannot be
|
||||||
@@ -2042,10 +2042,10 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
|||||||
in_port_t port;
|
in_port_t port;
|
||||||
dns_cache_t *cache = NULL;
|
dns_cache_t *cache = NULL;
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
isc_uint32_t max_adb_size;
|
|
||||||
unsigned int cleaning_interval;
|
unsigned int cleaning_interval;
|
||||||
isc_uint32_t max_cache_size;
|
size_t max_cache_size;
|
||||||
isc_uint32_t max_acache_size;
|
size_t max_acache_size;
|
||||||
|
size_t max_adb_size;
|
||||||
isc_uint32_t lame_ttl;
|
isc_uint32_t lame_ttl;
|
||||||
dns_tsig_keyring_t *ring = NULL;
|
dns_tsig_keyring_t *ring = NULL;
|
||||||
dns_view_t *pview = NULL; /* Production view */
|
dns_view_t *pview = NULL; /* Production view */
|
||||||
@@ -2148,21 +2148,21 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
|||||||
if (cfg_obj_isstring(obj)) {
|
if (cfg_obj_isstring(obj)) {
|
||||||
str = cfg_obj_asstring(obj);
|
str = cfg_obj_asstring(obj);
|
||||||
INSIST(strcasecmp(str, "unlimited") == 0);
|
INSIST(strcasecmp(str, "unlimited") == 0);
|
||||||
max_acache_size = ISC_UINT32_MAX;
|
max_acache_size = 0;
|
||||||
} else {
|
} else {
|
||||||
isc_resourcevalue_t value;
|
isc_resourcevalue_t value;
|
||||||
|
|
||||||
value = cfg_obj_asuint64(obj);
|
value = cfg_obj_asuint64(obj);
|
||||||
if (value > ISC_UINT32_MAX) {
|
if (value > SIZE_MAX) {
|
||||||
cfg_obj_log(obj, ns_g_lctx, ISC_LOG_ERROR,
|
cfg_obj_log(obj, ns_g_lctx,
|
||||||
|
ISC_LOG_WARNING,
|
||||||
"'max-acache-size "
|
"'max-acache-size "
|
||||||
"%" ISC_PRINT_QUADFORMAT
|
"%" ISC_PRINT_QUADFORMAT "u' "
|
||||||
"d' is too large",
|
"is too large for this "
|
||||||
value);
|
"system; reducing to %lu",
|
||||||
result = ISC_R_RANGE;
|
value, SIZE_MAX);
|
||||||
goto cleanup;
|
value = SIZE_MAX;
|
||||||
}
|
}
|
||||||
max_acache_size = (isc_uint32_t)value;
|
max_cache_size = (size_t) value;
|
||||||
}
|
}
|
||||||
dns_acache_setcachesize(view->acache, max_acache_size);
|
dns_acache_setcachesize(view->acache, max_acache_size);
|
||||||
}
|
}
|
||||||
@@ -2338,19 +2338,21 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
|||||||
if (cfg_obj_isstring(obj)) {
|
if (cfg_obj_isstring(obj)) {
|
||||||
str = cfg_obj_asstring(obj);
|
str = cfg_obj_asstring(obj);
|
||||||
INSIST(strcasecmp(str, "unlimited") == 0);
|
INSIST(strcasecmp(str, "unlimited") == 0);
|
||||||
max_cache_size = ISC_UINT32_MAX;
|
max_cache_size = 0;
|
||||||
} else {
|
} else {
|
||||||
isc_resourcevalue_t value;
|
isc_resourcevalue_t value;
|
||||||
value = cfg_obj_asuint64(obj);
|
value = cfg_obj_asuint64(obj);
|
||||||
if (value > ISC_UINT32_MAX) {
|
if (value > SIZE_MAX) {
|
||||||
cfg_obj_log(obj, ns_g_lctx, ISC_LOG_ERROR,
|
cfg_obj_log(obj, ns_g_lctx,
|
||||||
|
ISC_LOG_WARNING,
|
||||||
"'max-cache-size "
|
"'max-cache-size "
|
||||||
"%" ISC_PRINT_QUADFORMAT "d' is too large",
|
"%" ISC_PRINT_QUADFORMAT "u' "
|
||||||
value);
|
"is too large for this "
|
||||||
result = ISC_R_RANGE;
|
"system; reducing to %lu",
|
||||||
goto cleanup;
|
value, SIZE_MAX);
|
||||||
|
value = SIZE_MAX;
|
||||||
}
|
}
|
||||||
max_cache_size = (isc_uint32_t)value;
|
max_cache_size = (size_t) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check-names. */
|
/* Check-names. */
|
||||||
|
@@ -66,6 +66,7 @@ options {
|
|||||||
serial-queries 10;
|
serial-queries 10;
|
||||||
serial-query-rate 100;
|
serial-query-rate 100;
|
||||||
server-id none;
|
server-id none;
|
||||||
|
max-cache-size 20000000000000;
|
||||||
zone-statistics none;
|
zone-statistics none;
|
||||||
};
|
};
|
||||||
view "first" {
|
view "first" {
|
||||||
|
@@ -3413,12 +3413,14 @@ $ORIGIN 0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
|
|||||||
<para>
|
<para>
|
||||||
Integers may take values
|
Integers may take values
|
||||||
0 <= value <= 18446744073709551615, though
|
0 <= value <= 18446744073709551615, though
|
||||||
certain parameters may use a more limited range
|
certain parameters
|
||||||
within these extremes. In most cases, setting a
|
(such as <command>max-journal-size</command>) may
|
||||||
value to 0 does not literally mean zero; it means
|
use a more limited range within these extremes.
|
||||||
"undefined" or "as big as psosible", depending on
|
In most cases, setting a value to 0 does not
|
||||||
the context. See the expalantions of particular
|
literally mean zero; it means "undefined" or
|
||||||
parameters that use <varname>size_spec</varname>
|
"as big as possible", depending on the context.
|
||||||
|
See the expalantions of particular parameters
|
||||||
|
that use <varname>size_spec</varname>
|
||||||
for details on how they interpret its use.
|
for details on how they interpret its use.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
@@ -3434,13 +3436,8 @@ $ORIGIN 0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
<varname>unlimited</varname> generally means
|
<varname>unlimited</varname> generally means
|
||||||
"as big as possible", though in certain contexts,
|
"as big as possible", and is usually the best
|
||||||
(including <option>max-cache-size</option>), it may
|
way to safely set a very large number.
|
||||||
mean the largest possible 32-bit unsigned integer
|
|
||||||
(0xffffffff); this distinction can be important when
|
|
||||||
dealing with larger quantities.
|
|
||||||
<varname>unlimited</varname> is usually the best way
|
|
||||||
to safely set a very large number.
|
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
<varname>default</varname>
|
<varname>default</varname>
|
||||||
@@ -8425,8 +8422,10 @@ avoid-v6-udp-ports { 40000; range 50000 60000; };
|
|||||||
approaches
|
approaches
|
||||||
the specified size, some of the oldest transactions in the
|
the specified size, some of the oldest transactions in the
|
||||||
journal
|
journal
|
||||||
will be automatically removed. The default is
|
will be automatically removed. The largest permitted
|
||||||
<literal>unlimited</literal>.
|
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.
|
This may also be set on a per-zone basis.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
@@ -8498,22 +8497,18 @@ avoid-v6-udp-ports { 40000; range 50000 60000; };
|
|||||||
The maximum amount of memory to use for the
|
The maximum amount of memory to use for the
|
||||||
server's cache, in bytes.
|
server's cache, in bytes.
|
||||||
When the amount of data in the cache
|
When the amount of data in the cache
|
||||||
reaches this limit, the server will cause records to expire
|
reaches this limit, the server will cause records to
|
||||||
prematurely based on an LRU based strategy so that
|
expire prematurely based on an LRU based strategy so
|
||||||
the limit is not exceeded.
|
that the limit is not exceeded.
|
||||||
A value of 0 is special, meaning that
|
The keyword <userinput>unlimited</userinput>,
|
||||||
records are purged from the cache only when their
|
or the value 0, will place no limit on cache size;
|
||||||
|
records will be purged from the cache only when their
|
||||||
TTLs expire.
|
TTLs expire.
|
||||||
Another special keyword <userinput>unlimited</userinput>
|
Any positive values less than 2MB will be ignored
|
||||||
means the maximum value of 32-bit unsigned integers
|
and reset to 2MB.
|
||||||
(0xffffffff), which may not have the same effect as
|
|
||||||
0 on machines that support more than 32 bits of
|
|
||||||
memory space.
|
|
||||||
Any positive values less than 2MB will be ignored reset
|
|
||||||
to 2MB.
|
|
||||||
In a server with multiple views, the limit applies
|
In a server with multiple views, the limit applies
|
||||||
separately to the cache of each view.
|
separately to the cache of each view.
|
||||||
The default is 0.
|
The default is <userinput>unlimited</userinput>.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
@@ -1769,9 +1769,8 @@ dns_acache_setcleaninginterval(dns_acache_t *acache, unsigned int t) {
|
|||||||
* function for more details about the logic.
|
* function for more details about the logic.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dns_acache_setcachesize(dns_acache_t *acache, isc_uint32_t size) {
|
dns_acache_setcachesize(dns_acache_t *acache, size_t size) {
|
||||||
isc_uint32_t lowater;
|
size_t hiwater, lowater;
|
||||||
isc_uint32_t hiwater;
|
|
||||||
|
|
||||||
REQUIRE(DNS_ACACHE_VALID(acache));
|
REQUIRE(DNS_ACACHE_VALID(acache));
|
||||||
|
|
||||||
|
@@ -4164,9 +4164,8 @@ water(void *arg, int mark) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dns_adb_setadbsize(dns_adb_t *adb, isc_uint32_t size) {
|
dns_adb_setadbsize(dns_adb_t *adb, size_t size) {
|
||||||
isc_uint32_t hiwater;
|
size_t hiwater, lowater;
|
||||||
isc_uint32_t lowater;
|
|
||||||
|
|
||||||
INSIST(DNS_ADB_VALID(adb));
|
INSIST(DNS_ADB_VALID(adb));
|
||||||
|
|
||||||
|
@@ -139,7 +139,7 @@ struct dns_cache {
|
|||||||
char *db_type;
|
char *db_type;
|
||||||
int db_argc;
|
int db_argc;
|
||||||
char **db_argv;
|
char **db_argv;
|
||||||
isc_uint32_t size;
|
size_t size;
|
||||||
isc_stats_t *stats;
|
isc_stats_t *stats;
|
||||||
|
|
||||||
/* Locked by 'filelock'. */
|
/* Locked by 'filelock'. */
|
||||||
@@ -1048,9 +1048,8 @@ water(void *arg, int mark) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dns_cache_setcachesize(dns_cache_t *cache, isc_uint32_t size) {
|
dns_cache_setcachesize(dns_cache_t *cache, size_t size) {
|
||||||
isc_uint32_t lowater;
|
size_t hiwater, lowater;
|
||||||
isc_uint32_t hiwater;
|
|
||||||
|
|
||||||
REQUIRE(VALID_CACHE(cache));
|
REQUIRE(VALID_CACHE(cache));
|
||||||
|
|
||||||
@@ -1088,9 +1087,9 @@ dns_cache_setcachesize(dns_cache_t *cache, isc_uint32_t size) {
|
|||||||
isc_mem_setwater(cache->mctx, water, cache, hiwater, lowater);
|
isc_mem_setwater(cache->mctx, water, cache, hiwater, lowater);
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_uint32_t
|
size_t
|
||||||
dns_cache_getcachesize(dns_cache_t *cache) {
|
dns_cache_getcachesize(dns_cache_t *cache) {
|
||||||
isc_uint32_t size;
|
size_t size;
|
||||||
|
|
||||||
REQUIRE(VALID_CACHE(cache));
|
REQUIRE(VALID_CACHE(cache));
|
||||||
|
|
||||||
|
@@ -238,7 +238,7 @@ dns_acache_setcleaninginterval(dns_acache_t *acache, unsigned int t);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
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.
|
* Set the maximum additional cache size. 0 means unlimited.
|
||||||
*/
|
*/
|
||||||
|
@@ -607,7 +607,7 @@ dns_adb_flush(dns_adb_t *adb);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
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
|
* Set a target memory size. If memory usage exceeds the target
|
||||||
* size entries will be removed before they would have expired on
|
* size entries will be removed before they would have expired on
|
||||||
|
@@ -246,12 +246,6 @@ dns_cache_getcleaninginterval(dns_cache_t *cache);
|
|||||||
* Get the periodic cache cleaning interval to 'interval' seconds.
|
* 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 *
|
const char *
|
||||||
dns_cache_getname(dns_cache_t *cache);
|
dns_cache_getname(dns_cache_t *cache);
|
||||||
/*%<
|
/*%<
|
||||||
@@ -259,12 +253,12 @@ dns_cache_getname(dns_cache_t *cache);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
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.
|
* Set the maximum cache size. 0 means unlimited.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
isc_uint32_t
|
size_t
|
||||||
dns_cache_getcachesize(dns_cache_t *cache);
|
dns_cache_getcachesize(dns_cache_t *cache);
|
||||||
/*%<
|
/*%<
|
||||||
* Get the maximum cache size.
|
* Get the maximum cache size.
|
||||||
|
Reference in New Issue
Block a user