]> git.ipfire.org Git - thirdparty/bind9.git/commit
Remove the negative type logic from qpcache
authorOndřej Surý <ondrej@sury.org>
Mon, 11 Aug 2025 07:39:13 +0000 (09:39 +0200)
committerOndřej Surý <ondrej@isc.org>
Fri, 15 Aug 2025 05:22:52 +0000 (07:22 +0200)
commit6e2ca5e0d71f0db7412c9cd39c3bfea86d54867c
tree287e5522d454184673a193c6eede29879146b3ca
parent344536291892b8ccce7db98212385ae37d335cca
Remove the negative type logic from qpcache

Previously, when a negative header was stored in the cache, it would be
stored in the dns_typepair_t as .type = 0, .covers = <negative type>.
When searching the cache internally, we would have to look for both
positive and negative typepair and the slabheader .down list could be a
mix of positive and negative types.

Remove the extra representation of the negative type and simply use the
negative attribute on the slabheader.  Other units (namely dns_ncache)
can still insert the (0, type) negative rdatasets into the cache, but
internally, those will be converted into (type, 0) slabheaders, and vice
versa - when binding the rdatasets, the negative (type, 0) slabheader
will be converted to (0, type) rdataset.  Simple DNS_TYPEPAIR() helper
macro was added to simplify converting single rdatatype to typepair
value.

As a side-effect, the search logic in all places can exit early if
there's a negative header for the type we are looking for, f.e. when
searching for the zone cut, we don't have to walk through all the
slabheaders, if there's a stored negative slabheader.
lib/dns/db_p.h
lib/dns/include/dns/rdatatype.h
lib/dns/qpcache.c
lib/dns/qpzone.c
lib/dns/rdataslab.c