mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Prepend qpkey with denial byte
In preparation to merge the three qp tries (tree, nsec, nsec3) into one, add the piece of information into the qpkey. This is the most significant bit of information, so prepend the denial type to the qpkey. This means we need to pass on the denial type when constructing the qpkey from a name, or doing a lookup. Reuse the the DNS_DB_NSEC_* values. Most qp tries in the code we just pass on 0 (nta, rpz, zt, etc.), because there is no need for denial of existence, but for qpzone and qpcache we must pass the right value. Change the code, so that node->nsec no longer can have the value DNS_DB_NSEC_HAS_NSEC, instead track this in a new attribute 'havensec'. Since we use node->nsec to convert names to keys, the value MUST be set before inserting the node into the qp-trie. Update the fuzzing and unit tests accordingly. This only adds a few extra test cases, more are needed. In the qp_test.c we can remove test code for empty keys as this is no longer possible.
This commit is contained in:
@@ -316,7 +316,7 @@ dns_ntatable_add(dns_ntatable_t *ntatable, const dns_name_t *name, bool force,
|
||||
result = dns_qp_insert(qp, nta, 0);
|
||||
switch (result) {
|
||||
case ISC_R_EXISTS:
|
||||
result = dns_qp_getname(qp, &nta->name, &pval, NULL);
|
||||
result = dns_qp_getname(qp, &nta->name, 0, &pval, NULL);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
/*
|
||||
* an NTA already existed: throw away the
|
||||
@@ -355,7 +355,7 @@ dns_ntatable_delete(dns_ntatable_t *ntatable, const dns_name_t *name) {
|
||||
REQUIRE(name != NULL);
|
||||
|
||||
dns_qpmulti_write(ntatable->table, &qp);
|
||||
result = dns_qp_deletename(qp, name, &pval, NULL);
|
||||
result = dns_qp_deletename(qp, name, 0, &pval, NULL);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
dns__nta_t *n = pval;
|
||||
dns__nta_shutdown(n);
|
||||
@@ -379,7 +379,7 @@ delete_expired(void *arg) {
|
||||
|
||||
RWLOCK(&ntatable->rwlock, isc_rwlocktype_write);
|
||||
dns_qpmulti_write(ntatable->table, &qp);
|
||||
result = dns_qp_getname(qp, &nta->name, &pval, NULL);
|
||||
result = dns_qp_getname(qp, &nta->name, 0, &pval, NULL);
|
||||
if (result == ISC_R_SUCCESS &&
|
||||
((dns__nta_t *)pval)->expiry == nta->expiry && !nta->shuttingdown)
|
||||
{
|
||||
@@ -387,7 +387,7 @@ delete_expired(void *arg) {
|
||||
dns_name_format(&nta->name, nb, sizeof(nb));
|
||||
isc_log_write(DNS_LOGCATEGORY_DNSSEC, DNS_LOGMODULE_NTA,
|
||||
ISC_LOG_INFO, "deleting expired NTA at %s", nb);
|
||||
dns_qp_deletename(qp, &nta->name, NULL, NULL);
|
||||
dns_qp_deletename(qp, &nta->name, 0, NULL, NULL);
|
||||
dns__nta_shutdown(nta);
|
||||
dns__nta_unref(nta);
|
||||
}
|
||||
@@ -649,7 +649,7 @@ static size_t
|
||||
qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval,
|
||||
uint32_t ival ISC_ATTR_UNUSED) {
|
||||
dns__nta_t *nta = pval;
|
||||
return dns_qpkey_fromname(key, &nta->name);
|
||||
return dns_qpkey_fromname(key, &nta->name, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user