]> git.ipfire.org Git - thirdparty/bind9.git/commit
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)
commitb084f8387fda655a82b2bb8352000b80ce662685
tree0f9114fdd5e6149b570c2d7803b5dd5dbafbe8aa
parent723439908acb4522274184b49428c86551bd2937
parenta05db4196fd854326a442e53fbb071518507ddd5
chg: dev: Split dbmethods into node and db vtable

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