From 37fa960bd5e1d5bc8657d636db9d7eae40207ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 27 Aug 2025 13:52:42 +0200 Subject: [PATCH] Add few missing qpcache_hit() calls There were couple of missing qpcache_hit() calls in qpcache.c:add() function where existing data was better than the newly added header. --- lib/dns/qpcache.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/dns/qpcache.c b/lib/dns/qpcache.c index 631639473f..be47fd85a0 100644 --- a/lib/dns/qpcache.c +++ b/lib/dns/qpcache.c @@ -2559,6 +2559,7 @@ expire_ncache_entry(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabtop_t *top, /* * The NXDOMAIN/NODATA(QTYPE=ANY) is more trusted. */ + qpcache_hit(qpdb, top->header); bindrdataset(qpdb, qpnode, top->header, now, nlocktype, tlocktype, addedrdataset DNS__DB_FLARG_PASS); @@ -2751,6 +2752,7 @@ add(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabheader_t *newheader, if (trust < header->trust && (ACTIVE(header, now) || !EXISTS(header))) { + qpcache_hit(qpdb, header); bindrdataset(qpdb, qpnode, header, now, nlocktype, tlocktype, addedrdataset DNS__DB_FLARG_PASS); @@ -2774,8 +2776,6 @@ add(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabheader_t *newheader, qpdb->common.rdclass, DNS_TYPEPAIR_TYPE(header->typepair))) { - qpcache_hit(qpdb, header); - if (header->noqname == NULL && newheader->noqname != NULL) { @@ -2788,6 +2788,8 @@ add(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabheader_t *newheader, header->closest = newheader->closest; newheader->closest = NULL; } + + qpcache_hit(qpdb, header); bindrdataset(qpdb, qpnode, header, now, nlocktype, tlocktype, addedrdataset DNS__DB_FLARG_PASS); @@ -2824,8 +2826,6 @@ add(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabheader_t *newheader, header->expire < newheader->expire && dns_rdataslab_equal(header, newheader)) { - qpcache_hit(qpdb, header); - if (header->noqname == NULL && newheader->noqname != NULL) { @@ -2838,6 +2838,8 @@ add(qpcache_t *qpdb, qpcnode_t *qpnode, dns_slabheader_t *newheader, header->closest = newheader->closest; newheader->closest = NULL; } + + qpcache_hit(qpdb, header); bindrdataset(qpdb, qpnode, header, now, nlocktype, tlocktype, addedrdataset DNS__DB_FLARG_PASS);