]> git.ipfire.org Git - thirdparty/bind9.git/commit
Redesign the unreachable primaries cache
authorAram Sargsyan <aram@isc.org>
Tue, 18 Feb 2025 08:34:41 +0000 (08:34 +0000)
committerAram Sargsyan <aram@isc.org>
Wed, 4 Jun 2025 09:16:35 +0000 (09:16 +0000)
commit14915b024142c91ff7c70969b3097ddb6ebbca22
treed3d3ea154c5716f2cb1176100beaba0cb42d14d6
parentbb1458460b36f624cd765c1047eb5c457ddda4f7
Redesign the unreachable primaries cache

The cache for unreachable primaries was added to BIND 9 in 2006 via
1372e172d0e0b08996376b782a9041d1e3542489. It features a 10-slot LRU
array with 600 seconds (10 minutes) fixed delay. During this time, any
primary with a hiccup would be blocked for the whole block duration
(unless overwritten by a different entry).

As this design is not very flexible (i.e. the fixed delay and the fixed
amount of the slots), redesign it based on the badcache.c module, which
was implemented earlier for a similar mechanism.

The differences between the new code and the badcache module were large
enough to create a new module instead of trying to make the badcache
module universal, which could complicate the implementation.

The new design implements an exponential backoff for entries which are
added again soon after expiring, i.e. the next expiration happens in
double the amount of time of the previous expiration, but in no more
time than the defined maximum value.

The initial and the maximum expiration values are hard-coded, but, if
required, it should be trivial to implement configurable knobs.
12 files changed:
lib/dns/Makefile.am
lib/dns/include/dns/types.h
lib/dns/include/dns/unreachcache.h [new file with mode: 0644]
lib/dns/include/dns/view.h
lib/dns/include/dns/zone.h
lib/dns/unreachcache.c [new file with mode: 0644]
lib/dns/view.c
lib/dns/xfrin.c
lib/dns/zone.c
tests/dns/Makefile.am
tests/dns/unreachcache_test.c [new file with mode: 0644]
tests/dns/zonemgr_test.c