2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Expand the list of the priority types and move it to db_p.h

Add HTTPS, SVCB, SRV, PTR, NAPTR, DNSKEY and TXT records to the list of
the priority types that are put at the beginning of the slabheader list
for faster access and to avoid eviction when there are more types than
the max-types-per-name limit.
This commit is contained in:
Ondřej Surý
2024-06-17 11:40:40 +02:00
parent b8522e5b8e
commit b27c6bcce8
5 changed files with 44 additions and 73 deletions

View File

@@ -145,4 +145,46 @@ typedef struct {
bool exiting; bool exiting;
} db_nodelock_t; } db_nodelock_t;
static inline bool
prio_type(dns_typepair_t type) {
switch (type) {
case dns_rdatatype_soa:
case DNS_SIGTYPE(dns_rdatatype_soa):
case dns_rdatatype_a:
case DNS_SIGTYPE(dns_rdatatype_a):
case dns_rdatatype_mx:
case DNS_SIGTYPE(dns_rdatatype_mx):
case dns_rdatatype_aaaa:
case DNS_SIGTYPE(dns_rdatatype_aaaa):
case dns_rdatatype_nsec:
case DNS_SIGTYPE(dns_rdatatype_nsec):
case dns_rdatatype_nsec3:
case DNS_SIGTYPE(dns_rdatatype_nsec3):
case dns_rdatatype_ns:
case DNS_SIGTYPE(dns_rdatatype_ns):
case dns_rdatatype_ds:
case DNS_SIGTYPE(dns_rdatatype_ds):
case dns_rdatatype_cname:
case DNS_SIGTYPE(dns_rdatatype_cname):
case dns_rdatatype_dname:
case DNS_SIGTYPE(dns_rdatatype_dname):
case dns_rdatatype_svcb:
case DNS_SIGTYPE(dns_rdatatype_svcb):
case dns_rdatatype_https:
case DNS_SIGTYPE(dns_rdatatype_https):
case dns_rdatatype_dnskey:
case DNS_SIGTYPE(dns_rdatatype_dnskey):
case dns_rdatatype_srv:
case DNS_SIGTYPE(dns_rdatatype_srv):
case dns_rdatatype_txt:
case DNS_SIGTYPE(dns_rdatatype_txt):
case dns_rdatatype_ptr:
case DNS_SIGTYPE(dns_rdatatype_ptr):
case dns_rdatatype_naptr:
case DNS_SIGTYPE(dns_rdatatype_naptr):
return (true);
}
return (false);
}
ISC_LANG_ENDDECLS ISC_LANG_ENDDECLS

View File

@@ -2438,30 +2438,6 @@ again:
} }
} }
static bool
prio_type(dns_typepair_t type) {
switch (type) {
case dns_rdatatype_soa:
case DNS_SIGTYPE(dns_rdatatype_soa):
case dns_rdatatype_a:
case DNS_SIGTYPE(dns_rdatatype_a):
case dns_rdatatype_aaaa:
case DNS_SIGTYPE(dns_rdatatype_aaaa):
case dns_rdatatype_nsec:
case DNS_SIGTYPE(dns_rdatatype_nsec):
case dns_rdatatype_nsec3:
case DNS_SIGTYPE(dns_rdatatype_nsec3):
case dns_rdatatype_ns:
case DNS_SIGTYPE(dns_rdatatype_ns):
case dns_rdatatype_ds:
case DNS_SIGTYPE(dns_rdatatype_ds):
case dns_rdatatype_cname:
case DNS_SIGTYPE(dns_rdatatype_cname):
return (true);
}
return (false);
}
/*% /*%
* These functions allow the heap code to rank the priority of each * These functions allow the heap code to rank the priority of each
* element. It returns true if v1 happens "sooner" than v2. * element. It returns true if v1 happens "sooner" than v2.

View File

@@ -330,31 +330,6 @@ typedef struct qpdb_dbiterator {
*/ */
static atomic_uint_fast16_t init_count = 0; static atomic_uint_fast16_t init_count = 0;
static bool
prio_type(dns_typepair_t type) {
switch (type) {
case dns_rdatatype_soa:
case DNS_SIGTYPE(dns_rdatatype_soa):
case dns_rdatatype_a:
case DNS_SIGTYPE(dns_rdatatype_a):
case dns_rdatatype_aaaa:
case DNS_SIGTYPE(dns_rdatatype_aaaa):
case dns_rdatatype_nsec:
case DNS_SIGTYPE(dns_rdatatype_nsec):
case dns_rdatatype_ns:
case DNS_SIGTYPE(dns_rdatatype_ns):
case dns_rdatatype_ds:
case DNS_SIGTYPE(dns_rdatatype_ds):
case dns_rdatatype_nsec3:
case DNS_SIGTYPE(dns_rdatatype_nsec3):
case dns_rdatatype_cname:
case DNS_SIGTYPE(dns_rdatatype_cname):
return (true);
}
return (false);
}
/* /*
* Locking * Locking
* *

View File

@@ -351,30 +351,6 @@ dns__rbtdb_setttl(dns_slabheader_t *header, dns_ttl_t newttl) {
} }
} }
static bool
prio_type(dns_typepair_t type) {
switch (type) {
case dns_rdatatype_soa:
case DNS_SIGTYPE(dns_rdatatype_soa):
case dns_rdatatype_a:
case DNS_SIGTYPE(dns_rdatatype_a):
case dns_rdatatype_aaaa:
case DNS_SIGTYPE(dns_rdatatype_aaaa):
case dns_rdatatype_nsec:
case DNS_SIGTYPE(dns_rdatatype_nsec):
case dns_rdatatype_nsec3:
case DNS_SIGTYPE(dns_rdatatype_nsec3):
case dns_rdatatype_ns:
case DNS_SIGTYPE(dns_rdatatype_ns):
case dns_rdatatype_ds:
case DNS_SIGTYPE(dns_rdatatype_ds):
case dns_rdatatype_cname:
case DNS_SIGTYPE(dns_rdatatype_cname):
return (true);
}
return (false);
}
/*% /*%
* These functions allow the heap code to rank the priority of each * These functions allow the heap code to rank the priority of each
* element. It returns true if v1 happens "sooner" than v2. * element. It returns true if v1 happens "sooner" than v2.

View File

@@ -21,6 +21,8 @@
#include <dns/rbt.h> #include <dns/rbt.h>
#include <dns/types.h> #include <dns/types.h>
#include "db_p.h" /* for db_nodelock_t */
/*% /*%
* Note that "impmagic" is not the first four bytes of the struct, so * Note that "impmagic" is not the first four bytes of the struct, so
* ISC_MAGIC_VALID cannot be used. * ISC_MAGIC_VALID cannot be used.