mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Switch the locknum generation for qpznode to random
Instead of using on hash of the name modulo number of the buckets, assign the locknum randomly with isc_random_uniform(). This makes the locknum assignment aligned with qpcache and allows the bucket number to be non-prime in the future.
This commit is contained in:
@@ -595,10 +595,11 @@ new_qpznode(qpzonedb_t *qpdb, const dns_name_t *name) {
|
|||||||
*newdata = (qpznode_t){
|
*newdata = (qpznode_t){
|
||||||
.name = DNS_NAME_INITEMPTY,
|
.name = DNS_NAME_INITEMPTY,
|
||||||
.references = ISC_REFCOUNT_INITIALIZER(1),
|
.references = ISC_REFCOUNT_INITIALIZER(1),
|
||||||
|
.locknum = isc_random_uniform(qpdb->buckets_count),
|
||||||
};
|
};
|
||||||
newdata->locknum = dns_name_hash(name) % qpdb->buckets_count;
|
|
||||||
dns_name_dupwithoffsets(name, qpdb->common.mctx, &newdata->name);
|
|
||||||
isc_mem_attach(qpdb->common.mctx, &newdata->mctx);
|
isc_mem_attach(qpdb->common.mctx, &newdata->mctx);
|
||||||
|
dns_name_dupwithoffsets(name, qpdb->common.mctx, &newdata->name);
|
||||||
|
|
||||||
#if DNS_DB_NODETRACE
|
#if DNS_DB_NODETRACE
|
||||||
fprintf(stderr, "new_qpznode:%s:%s:%d:%p->references = 1\n", __func__,
|
fprintf(stderr, "new_qpznode:%s:%s:%d:%p->references = 1\n", __func__,
|
||||||
|
Reference in New Issue
Block a user