mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
initialize header in dns_rdataslab_fromrdataset()
when dns_rdataslab_fromrdataset() is run, in addition to allocating space for a slab header, it also partially initializes it, setting the type match rdataset->type and rdataset->covers, the trust to rdataset->trust, and the TTL to rdataset->ttl.
This commit is contained in:
@@ -3201,18 +3201,20 @@ qpcache_addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
||||
dns_rdataset_getownercase(rdataset, name);
|
||||
|
||||
newheader = (dns_slabheader_t *)region.base;
|
||||
*newheader = (dns_slabheader_t){
|
||||
.type = DNS_TYPEPAIR_VALUE(rdataset->type, rdataset->covers),
|
||||
.trust = rdataset->trust,
|
||||
.last_used = now,
|
||||
.node = (dns_dbnode_t *)qpnode,
|
||||
};
|
||||
|
||||
dns_slabheader_reset(newheader, db, node);
|
||||
|
||||
newheader->last_used = now;
|
||||
|
||||
/*
|
||||
* By default, dns_rdataslab_fromrdataset() sets newheader->ttl
|
||||
* to the rdataset TTL. In the case of the cache, that's wrong;
|
||||
* we need it to be set to the expire time instead.
|
||||
*/
|
||||
setttl(newheader, rdataset->ttl + now);
|
||||
if (rdataset->ttl == 0U) {
|
||||
DNS_SLABHEADER_SETATTR(newheader, DNS_SLABHEADERATTR_ZEROTTL);
|
||||
}
|
||||
|
||||
atomic_init(&newheader->count,
|
||||
atomic_fetch_add_relaxed(&init_count, 1));
|
||||
if ((rdataset->attributes & DNS_RDATASETATTR_PREFETCH) != 0) {
|
||||
|
Reference in New Issue
Block a user