[9.20] fix: usr: Fix TLS contexts cache object usage bug in the resolver

:iscman:`named` could terminate unexpectedly when reconfiguring or
reloading, and if client-side TLS transport was in use (for example,
when forwarding queries to a DoT server). This has been fixed.

Closes #5653

Backport of MR !11295

Merge branch 'backport-5653-tlsctx_cache-reference-bug-fix-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!11299
This commit is contained in:
Arаm Sаrgsyаn 2025-11-27 21:26:14 +00:00
commit 13adf94006

View file

@ -10083,6 +10083,8 @@ dns_resolver__destroy(dns_resolver_t *res) {
isc_hashmap_destroy(&res->counters);
isc_rwlock_destroy(&res->counters_lock);
isc_tlsctx_cache_detach(&res->tlsctx_cache);
if (res->dispatches4 != NULL) {
dns_dispatchset_destroy(&res->dispatches4);
}
@ -10160,7 +10162,6 @@ dns_resolver_create(dns_view_t *view, isc_loopmgr_t *loopmgr, isc_nm_t *nm,
.rdclass = view->rdclass,
.nm = nm,
.options = options,
.tlsctx_cache = tlsctx_cache,
.spillatmin = 10,
.spillat = 10,
.spillatmax = 100,
@ -10205,6 +10206,8 @@ dns_resolver_create(dns_view_t *view, isc_loopmgr_t *loopmgr, isc_nm_t *nm,
res->nloops);
}
isc_tlsctx_cache_attach(tlsctx_cache, &res->tlsctx_cache);
isc_mutex_init(&res->lock);
isc_mutex_init(&res->primelock);