summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormenakite <29005531+menakite@users.noreply.github.com>2024-08-15 22:01:23 +0200
committerVladimír Čunát <vladimir.cunat@nic.cz>2024-09-06 12:26:40 +0200
commit9e0b9d121655ca2571f8cc4249b5037528897993 (patch)
tree6f5db4ac5f429a0bfbfeadd90d99a62fb00b085e /lib
parentvalidator: set EDE code if SEP does not match or DNSKEY is revoked. (diff)
downloadknot-resolver-9e0b9d121655ca2571f8cc4249b5037528897993.tar.xz
knot-resolver-9e0b9d121655ca2571f8cc4249b5037528897993.zip
cache: set EDE when synthesizing answer from aggressive cache
Diffstat (limited to 'lib')
-rw-r--r--lib/cache/peek.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/cache/peek.c b/lib/cache/peek.c
index d12031fc..46a4868c 100644
--- a/lib/cache/peek.c
+++ b/lib/cache/peek.c
@@ -214,6 +214,7 @@ int peek_nosync(kr_layer_t *ctx, knot_pkt_t *pkt)
/* Try the NSEC* parameters in order, until success.
* Let's not mix different parameters for NSEC* RRs in a single proof. */
+ bool is_synthesized = false;
for (int i = 0; ;) {
int32_t log_new_ttl = -123456789; /* visually recognizable value */
ret = nsec_p_ttl(el[i], qry->timestamp.tv_sec, &log_new_ttl);
@@ -234,6 +235,7 @@ int peek_nosync(kr_layer_t *ctx, knot_pkt_t *pkt)
/**** 2. and 3. inside */
ret = peek_encloser(k, &ans, sname_labels,
lowest_rank, qry, cache);
+ is_synthesized = (ret == 0);
nsec_p_cleanup(&ans.nsec_p);
if (!ret) break;
if (ret < 0) return ctx->state;
@@ -316,6 +318,10 @@ int peek_nosync(kr_layer_t *ctx, knot_pkt_t *pkt)
qf->CACHED = true;
qf->NO_MINIMIZE = true;
+ if (is_synthesized && qry == req->rplan.initial) {
+ kr_request_set_extended_error(req, KNOT_EDNS_EDE_SYNTHESIZED,
+ "2NEP: synthesized from aggressive cache");
+ }
return KR_STATE_DONE;
}