]> git.ipfire.org Git - thirdparty/bind9.git/commit
Store negative cache entries under their natural type 12481/head
authorOndřej Surý <ondrej@isc.org>
Thu, 30 Jul 2026 15:42:26 +0000 (17:42 +0200)
committerEvan Hunt <each@isc.org>
Fri, 31 Jul 2026 19:13:19 +0000 (19:13 +0000)
commitb4f36cbc25cfade17a0adf053ff90b17dfe55bea
tree143be9bb7c18b1e4a6aa13dcb016572047a352ed
parent9da4f0c79d6c720e35fa6da24530a776272e9b1e
Store negative cache entries under their natural type

Negative cache entries were exposed through dns_rdataset_t in an
inverted shape (type=none, covers=<qtype>) while the cache internally
stored them under (<qtype>, none) with a NEGATIVE flag, so every
consumer had to convert between the two representations, and several
places relied on type==0 as an implicit negativity test.

Expose negative entries in their natural shape instead: type holds the
RR type whose nonexistence is cached (dns_rdatatype_any for NXDOMAIN
and NODATA(QTYPE=ANY) proofs), covers stays none, and the negative
attribute marks the entry.  The implicit type==0 tests become explicit
attribute checks, and the cache database now rejects meta-types other
than ANY, which remains valid as a lookup type and as a negative
entry.
12 files changed:
lib/dns/client.c
lib/dns/include/dns/db.h
lib/dns/include/dns/ncache.h
lib/dns/include/dns/rdatatype.h
lib/dns/masterdump.c
lib/dns/ncache.c
lib/dns/qpcache.c
lib/dns/rdataslab.c
lib/dns/rdatavec.c
lib/dns/resolver.c
lib/dns/validator.c
lib/ns/query.c