]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
chg: dev: Split dbmethods into node and db vtable
authorAlessio Podda <alessio@isc.org>
Thu, 14 Aug 2025 10:10:21 +0000 (10:10 +0000)
committerAlessio Podda <alessio@isc.org>
Thu, 14 Aug 2025 10:10:21 +0000 (10:10 +0000)
All databases in the codebase follow the same structure: a database is
an associative container from DNS names to nodes, and each node is an
associative container from RR types to RR data.

Each database implementation (qpzone, qpcache, sdlz, builtin, dyndb) has
its own corresponding node type (qpznode, qpcnode, etc). However, some
code needs to work with nodes generically regardless of their specific
type - for example, to acquire locks, manage references, or
register/unregister slabs from the heap.

Before this MR, these generic node operations were implemented as methods in
a `dns_dbmethods_t` vtable. This created a coupling between the database
and node lifetimes. If a node were to outlive its parent database, the node
destructor would destroy all RR data, and each RR data destructor would
try to unregister from heaps by calling a virtual function from the
database vtable. Since the database was already freed, this would cause a
crash.

This MR breaks the coupling by standardizing the layout of all
database nodes, adding a `dns_dbnode_methods_t` vtable for node
operations, and moving node-specific methods from the database vtable to
the node vtable.

Merge branch 'alessio/dbnode-vtable' into 'main'

See merge request isc-projects/bind9!10728


Trivial merge