fix: dev: Keep RRL ncache fixed name alive

Move the fixed name storage out of the NCACHE branch so the name passed to dns_rrl() remains valid for cached NXDOMAIN responses.

Closes #6029

Merge branch '6029-fixedname-fix' into 'main'

See merge request isc-projects/bind9!12096
This commit is contained in:
Alessio Podda 2026-06-16 11:01:52 +00:00
commit 074efb5768
2 changed files with 35 additions and 2 deletions

View file

@ -0,0 +1,32 @@
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import dns.rcode
import isctest
def test_rrl_cached_recursive_nxdomain(ns2):
query = isctest.query.create("ncache.tld3.", "A", dnssec=False)
# Prime ns2's negative cache, then query it again to exercise
# query_checkrrl() with DNS_R_NCACHENXDOMAIN.
response = isctest.query.udp(
query, ns2.ip, port=ns2.ports.dns, timeout=5, attempts=3
)
assert response.rcode() == dns.rcode.NXDOMAIN
response = isctest.query.udp(
query, ns2.ip, port=ns2.ports.dns, timeout=5, attempts=3
)
assert response.rcode() == dns.rcode.NXDOMAIN
ns2.rndc("status")

View file

@ -6839,6 +6839,7 @@ query_checkrrl(query_ctx_t *qctx, isc_result_t result) {
{
bool wouldlog;
const dns_name_t *constname;
dns_fixedname_t constname_fixed;
char log_buf[DNS_RRL_LOG_BUF_LEN];
isc_result_t resp_result;
dns_rrl_result_t rrl_result;
@ -6864,8 +6865,8 @@ query_checkrrl(query_ctx_t *qctx, isc_result_t result) {
* Try to use owner name in the negative cache SOA.
*/
dns_rdataset_t nc_rdataset = DNS_RDATASET_INIT;
dns_fixedname_t fixed;
dns_name_t *n = dns_fixedname_initname(&fixed);
dns_name_t *n =
dns_fixedname_initname(&constname_fixed);
DNS_RDATASET_FOREACH(qctx->rdataset) {
dns_ncache_current(qctx->rdataset, n,
&nc_rdataset);