From 91d5f755f270a77882ef8474f1fe3e2a58bf5d2c Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Mon, 6 Feb 2023 22:49:05 +0000 Subject: [PATCH] unbound: fix no-cache feature Years ago I submitted the no-cache feature to unbound which over time broke. I debugged it down to the point that pre-seeding no_cache_store will fix this with minimal changes and make no-cache work again which remains highly valuable in a lot of environments this got deployed. Obtained from: https://reviews.freebsd.org/D38057 --- services/mesh.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/mesh.c b/services/mesh.c index 9007b6e08..2e1d5c9dc 100644 --- a/services/mesh.c +++ b/services/mesh.c @@ -63,6 +63,7 @@ #include "util/data/dname.h" #include "respip/respip.h" #include "services/listen_dnsport.h" +#include "iterator/iter_utils.h" #ifdef CLIENT_SUBNET #include "edns-subnet/subnetmod.h" @@ -967,6 +968,10 @@ mesh_state_create(struct module_env* env, struct query_info* qinfo, mstate->s.edns_opts_back_in = NULL; mstate->s.edns_opts_front_out = NULL; + /* Pre-seed no_cache_store based on stub/forward info. */ + if (iter_stub_fwd_no_cache(&mstate->s, &mstate->s.qinfo, NULL, NULL)) + mstate->s.no_cache_store = 1; + return mstate; }