2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 01:59:26 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Ondřej Surý
9699eb0c7d
fixup! Allow negative RRSIGs in the qpcache again 2025-08-21 17:47:29 +02:00
Ondřej Surý
7235a733e0
Allow negative RRSIGs in the qpcache again
The previous refactoring added an assertion failure when negative RRSIG
would be added to the cache database.  As result, any query for RRSIG in
any unsigned zone would trigger that assertion failure.

Allow the negative RRSIG entries to be stored in the cache database
again as not caching these would trigger new remote fetch every time
such query would be received from a client.
2025-08-21 17:15:14 +02:00
Ondřej Surý
a3c338ae69
Add a test for non-existence of RRSIG in the unsigned zone
This tests that the result is NOERROR and a single SOA record is
returned.
2025-08-21 15:26:43 +02:00
2 changed files with 36 additions and 11 deletions

View File

@ -97,6 +97,20 @@ def test_insecure_glue():
assert "10.53.0.3" in addrs
def test_insecure_rrsig():
# check that for a rrsig query against a validating resolver where the
# authoritative zone is unsigned (insecure delegation), noerror is
# returned.
msg = isctest.query.create("a.insecure.example", "RRSIG")
res = isctest.query.tcp(msg, "10.53.0.4")
isctest.check.noerror(res)
isctest.check.rr_count_eq(res.answer, 0)
isctest.check.rr_count_eq(res.authority, 1)
isctest.check.rr_count_eq(res.additional, 0)
assert str(res.authority[0].name) == "insecure.example."
assert res.authority[0].rdtype == rdatatype.SOA
def test_adflag():
# compare auth and recursive answers
msg = isctest.query.create("a.example", "A", dnssec=False)

View File

@ -2083,9 +2083,6 @@ qpcache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
/* We can't search negative cache directly */
return ISC_R_NOTFOUND;
}
if (dns_rdatatype_issig(type) && covers == dns_rdatatype_none) {
return ISC_R_NOTFOUND;
}
nlock = &qpdb->buckets[qpnode->locknum].lock;
NODE_RDLOCK(nlock, &nlocktype);
@ -2555,9 +2552,8 @@ add(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabheader_t *newheader,
REQUIRE(rdtype != dns_rdatatype_none);
if (dns_rdatatype_issig(rdtype)) {
/* signature must be positive, and cover a type */
REQUIRE(!NEGATIVE(newheader));
REQUIRE(covers != dns_rdatatype_none);
/* signature must be either negative or cover something */
REQUIRE(NEGATIVE(newheader) || covers != dns_rdatatype_none);
} else {
/* otherwise, it must cover nothing */
REQUIRE(covers == dns_rdatatype_none);
@ -2593,6 +2589,26 @@ add(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabheader_t *newheader,
}
goto find_header;
}
if (dns_rdatatype_issig(rdtype)) {
/*
* If we're adding a proof that a signature
* doesn't exist, mark all signatures as
* ancient.
*/
for (top = qpnode->data; top != NULL;
top = top->next)
{
if (rdtype ==
DNS_TYPEPAIR_TYPE(top->typepair))
{
mark_ancient(top->header);
}
}
goto find_header;
}
/*
* Otherwise look for any RRSIGs of the given
* type so they can be marked ancient later.
@ -3154,11 +3170,6 @@ qpcache_deleterdataset(dns_db_t *db, dns_dbnode_t *node,
attributes |= DNS_SLABHEADERATTR_NEGATIVE;
}
/* RRSIG must have covered type */
if (type == dns_rdatatype_rrsig && covers == dns_rdatatype_none) {
return ISC_R_NOTIMPLEMENTED;
}
newheader = dns_slabheader_new(db->mctx, node);
newheader->typepair = DNS_TYPEPAIR_VALUE(type, covers);
setttl(newheader, 0);