bind9/lib/ns
Ondřej Surý 0c007d8659
Rename view->hints to view->rootdb and rearm priming
With the parent-centric resolver, dns_view_bestzonecut() consults the
delegation DB (view->deleg) rather than the main cache for the closest
zonecut.  Root is never the target of a referral, so it never lands in
delegdb; bestzonecut therefore falls through to the hints lookup on
every query whose closest ancestor is root.  prime_done() only called
dns_root_checkhints(), which logs discrepancies but does not update
any store bestzonecut looks at, so the fresh root NS records obtained
by priming were never used and priming kept re-firing.

Rename view->hints to view->rootdb and refresh it when a priming
fetch completes: the '.' NS rdataset is replaced with the fetched
one, and for each listed nameserver the matching A/AAAA glue is
copied from the response's ADDITIONAL section.  Only glue for names
that actually appear as NS targets is accepted, so a hostile response
cannot inject unrelated records.  Glue the response did not carry is
left untouched, so the hints-file records loaded at startup remain as
a fallback.

Each view gets its own rootdb: the previous shared
named_g_server->in_roothints is gone, and configure_view() calls
dns_rootns_create() per view when the class-IN defaults are needed.
That keeps the priming writer one-per-DB, so concurrent priming in
different views cannot race on the same zone-DB version.

The rootdb refresh runs synchronously from the resolver response path,
so records go straight from the wire into rootdb with no cache round
trip and no dependency on DNSSEC validation state.  A new
DNS_FETCHOPT_PRIMING option marks the priming fetch; prime_done()
itself is now pure cleanup.

Track the rootdb freshness window in view->rootdb_expires and trigger
re-priming lazily from dns_view_find() and bestzonecut_rootdb() only
when the window has elapsed.  Stale records are still served while the
fresh priming fetch is in flight.

Drop dns_root_checkhints() and its helpers; the rootdb is now the
authoritative source the resolver consults.
2026-04-16 13:39:18 +02:00
..
include Use delegation DB for bestzonecut lookups 2026-03-30 20:41:13 +02:00
.gitignore Add support for User Statically Defined Tracing (USDT) probes 2023-08-21 18:39:53 +02:00
client.c Move zone set/get properties to own source file 2026-04-02 15:50:07 +02:00
hooks.c use a standard CLEANUP macro 2025-12-03 13:45:43 -08:00
interfacemgr.c switch to RETERR where it wasn't being used 2025-12-03 13:45:43 -08:00
listenlist.c Use ControlStatementsExceptControlMacros for SpaceBeforeParens 2025-08-19 07:58:33 +02:00
meson.build Use unique names for probes.d files 2025-09-24 13:18:13 +02:00
notify.c Move zone set/get properties to own source file 2026-04-02 15:50:07 +02:00
probes-ns.d Use unique names for probes.d files 2025-09-24 13:18:13 +02:00
query.c Rename view->hints to view->rootdb and rearm priming 2026-04-16 13:39:18 +02:00
server.c Add low contention stats counter 2026-03-26 10:19:25 +01:00
stats.c Add low contention stats counter 2026-03-26 10:19:25 +01:00
tests Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
update.c Move zone set/get properties to own source file 2026-04-02 15:50:07 +02:00
xfrout.c Move zone set/get properties to own source file 2026-04-02 15:50:07 +02:00