Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended DNS Errors a la RFC8914 #504

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
285f93f
Add EDE EDNS0 Option code
wtoorop Jun 24, 2021
a8d78b2
Simple EDE example
wtoorop Jun 24, 2021
4049885
add locations for EDE errors
Aug 13, 2021
0703a38
Fix: use EDE codes with EDNS_OPT_APPEND_EDE
Aug 16, 2021
eac4eb3
Return EDE_DNSSEC_BOGUS when returning bogus answers
Aug 16, 2021
6b5f314
Show reason when returning EDE_DNSSEC_BOGUS
Aug 16, 2021
a9e6f6b
add variable bogus reason
Aug 17, 2021
b3f60db
add local anwser blocked
Aug 19, 2021
935634d
Revert "add local anwser blocked"
Aug 19, 2021
5fff0f7
Fix dont echo edns0 option list ...
Aug 19, 2021
a986597
EDE Blocked with local-zone refused answers
Aug 19, 2021
d9a947f
Merge branch 'master' into features/rfc8914-ede
Aug 20, 2021
ec4cf69
set up for tpkg test
Aug 23, 2021
fba1c30
add localzones test
Aug 23, 2021
33445be
add setup of RPZ and full tests of earlier implemented EDEs
Aug 31, 2021
7079f0b
add ede to always_refuse and always_null
Sep 6, 2021
9df75a8
add DNSSEC indeterminate EDE and DNAME expansion test
Sep 8, 2021
2360120
add mesh bogus test, possible locations for more EDE and remove super…
Sep 13, 2021
a664e8c
First step towards specific EDE DNSSEC errors
Sep 14, 2021
3576033
add possible EDE spots
Sep 15, 2021
5617de6
Answer LDNS_EDE_RRSIGS_MISSING for normal answers with missing signat…
Sep 15, 2021
4d15603
add routine to do EDE on ACL blocked messages
Sep 20, 2021
65852bc
Merge branch 'features/rfc8914-ede' of github.com:NLnetLabs/unbound i…
Sep 20, 2021
4df2965
add forgotten compile error fixes from previous commit
Sep 20, 2021
b606c82
Merge branch 'features/rfc8914-ede' of github.com:NLnetLabs/unbound i…
Sep 20, 2021
0b376cc
add routine to add EDE to ACL:refused at correct location
Sep 27, 2021
84da240
change strncpy to memmove at @wcawijngaards' suggestion
Sep 28, 2021
732ad94
process @wcawijngaards' comments
Sep 28, 2021
42ba5ae
process @wcawijngaards' comments v2
Sep 28, 2021
3ba8ea3
fix CH class response
Sep 28, 2021
320aa64
add QDCOUNT=0 to CHAOS query in ACL
Sep 29, 2021
7df2df0
add EDE response to autotrust_init_fail test
Sep 30, 2021
c42c2cb
add EDE response to autotrust_init_failsig test
Sep 30, 2021
86e8050
add EDE responses to unittests
Oct 1, 2021
8a6b3f0
add DNSKEY EDE code
Oct 8, 2021
b825bb6
add more tests
Oct 8, 2021
d2a719f
add test setup for DNSSEC EDEs
Oct 13, 2021
9bff0b9
- Introduce 'ede=<info-code>' and 'all_noedns' as options in the MATC…
gthess Oct 13, 2021
f7bb7f2
Merge branch 'features/rfc8914-ede' of github.com:NLnetLabs/unbound i…
gthess Oct 13, 2021
abd948f
change unittests to match just the ede code
Oct 13, 2021
fed0fb4
- Fix testcode, 0 is a valid EDE INFO-CODE.
gthess Oct 14, 2021
df984d9
add dnssec ede tests
Oct 18, 2021
0eba781
make local_data ede inclusion configurable, rewrite local_error_encod…
Nov 10, 2021
787d7a5
Merge branch 'master' into features/rfc8914-ede
Nov 15, 2021
f22e42f
Fix merge bugs
Nov 15, 2021
a3171a1
remove superfluous EDE left over from merge
Nov 16, 2021
4a43aee
setup for configurable EDEs for local-zone
Nov 16, 2021
0747d01
add missing parsing
Nov 16, 2021
0572870
change do_ede to be local-zone specific and add places for more EDE c…
Nov 19, 2021
575a686
add forgotten autogenerated files
Nov 19, 2021
7926874
add config option for global EDE flag, local-zone specific EDE flag a…
Nov 26, 2021
ff356b9
add error in case of incorrect string for local-zone-default-ede
Nov 26, 2021
3ccb4c6
change local-zone-default-ede keywords to '-', add missing {}, and ad…
Nov 30, 2021
db98a8b
add ede-local-zones in the manpage and update the iana_ports.inc for …
Nov 30, 2021
65ee2f2
finish up adding validator EDEs and other TODOs and fix tests with mo…
Dec 6, 2021
63e6604
add config options to test conf, fix local-zone EDE printing logic, a…
Dec 7, 2021
dc38aac
expand ede.tdir to do validator test for DNSKEY, RRSIG and NSEC missing
Dec 15, 2021
ea1a5f3
add todo for tests and fix EDE codes for DNSKEY missing
Dec 15, 2021
4f37d64
fix DNSSEC nsec-failure test
Dec 15, 2021
df229db
Merge branch 'master' into features/rfc8914-ede
TCY16 Dec 15, 2021
05e06fd
fix rpl tests
Dec 15, 2021
7902448
Document how the log-val-level: config options influences the returne…
Dec 16, 2021
fe8ef6e
add logic for per zone EDE for RPZ and configurable rpz-do-ede
Dec 21, 2021
94f04a7
remove superfluous linebreaks
Dec 21, 2021
49f2960
add remote control options for local-zone and RPZ do_ede
Dec 22, 2021
69e188b
fix missing disable in remote-control local_zone do_ede and typos
Dec 22, 2021
80957b6
remove debug line
Jan 10, 2022
9ae988c
Merge branch 'master' into review-rfc8914-ede
wtoorop Jan 11, 2022
8c96e26
modify tdir to ignore localzone tests
Jan 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 142 additions & 5 deletions daemon/worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
msg->rep, LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad,
worker->env.now_tv))
return 0;
EDNS_OPT_LIST_APPEND_EDE(&edns->opt_list_out,
worker->scratchpad, LDNS_EDE_DNSSEC_BOGUS, "");
error_encode(repinfo->c->buffer, LDNS_RCODE_SERVFAIL,
&msg->qinfo, id, flags, edns);
if(worker->stats.extended) {
Expand All @@ -499,6 +501,9 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
secure = 1;
break;
case sec_status_indeterminate:
EDNS_OPT_LIST_APPEND_EDE(&edns->opt_list_out,
worker->scratchpad, LDNS_EDE_DNSSEC_INDETERMINATE, "");
/* fallthrough */
case sec_status_insecure:
default:
/* not secure */
Expand Down Expand Up @@ -654,6 +659,8 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
LDNS_RCODE_SERVFAIL, edns, repinfo, worker->scratchpad,
worker->env.now_tv))
goto bail_out;
EDNS_OPT_LIST_APPEND_EDE(&edns->opt_list_out,
worker->scratchpad, LDNS_EDE_DNSSEC_BOGUS, "");
error_encode(repinfo->c->buffer, LDNS_RCODE_SERVFAIL,
qinfo, id, flags, edns);
rrset_array_unlock_touch(worker->env.rrset_cache,
Expand Down Expand Up @@ -1020,6 +1027,8 @@ deny_refuse(struct comm_point* c, enum acl_access acl,
worker->stats.unwanted_queries++;
return 0;
} else if(acl == refuse) {
size_t opt_rr_mark;

log_addr(VERB_ALGO, "refused query from",
&repinfo->addr, repinfo->addrlen);
log_buf(VERB_ALGO, "refuse", c->buffer);
Expand All @@ -1029,15 +1038,124 @@ deny_refuse(struct comm_point* c, enum acl_access acl,
comm_point_drop_reply(repinfo);
return 0; /* discard this */
}
sldns_buffer_set_limit(c->buffer, LDNS_HEADER_SIZE);
sldns_buffer_write_at(c->buffer, 4,
(uint8_t*)"\0\0\0\0\0\0\0\0", 8);
log_assert(LDNS_QDCOUNT(sldns_buffer_begin(c->buffer)) == 1);

sldns_buffer_skip(c->buffer, LDNS_HEADER_SIZE); /* skip header */

if (!query_dname_len(c->buffer)) {
LDNS_QR_SET(sldns_buffer_begin(c->buffer));
LDNS_RCODE_SET(sldns_buffer_begin(c->buffer),
LDNS_RCODE_FORMERR);
sldns_buffer_flip(c->buffer);
return 1;
}
if (sldns_buffer_remaining(c->buffer) < 2 * sizeof(uint16_t)) {
LDNS_QR_SET(sldns_buffer_begin(c->buffer));
LDNS_RCODE_SET(sldns_buffer_begin(c->buffer),
LDNS_RCODE_FORMERR);
sldns_buffer_flip(c->buffer);
return 1;
}
LDNS_QR_SET(sldns_buffer_begin(c->buffer));
LDNS_RCODE_SET(sldns_buffer_begin(c->buffer),
LDNS_RCODE_REFUSED);
sldns_buffer_set_position(c->buffer, LDNS_HEADER_SIZE);

sldns_buffer_skip(c->buffer, (ssize_t)sizeof(uint16_t)); /* skip qtype */

/* check the qclass */
if (sldns_buffer_read_u16(c->buffer) != LDNS_RR_CLASS_IN) {
LDNS_QDCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
LDNS_ANCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
LDNS_NSCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
LDNS_ARCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
sldns_buffer_flip(c->buffer);
return 1;
}

/* check edns section is present */
if(LDNS_ARCOUNT(sldns_buffer_begin(c->buffer)) != 1) {
LDNS_ANCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
LDNS_NSCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
LDNS_ARCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
sldns_buffer_flip(c->buffer);
return 1;
}

/* The OPT RR to be returned should come directly after
* the query, so mark this spot.
*/
opt_rr_mark = sldns_buffer_position(c->buffer);

/* Skip through the RR records */
if(LDNS_ANCOUNT(sldns_buffer_begin(c->buffer)) != 0 ||
LDNS_NSCOUNT(sldns_buffer_begin(c->buffer)) != 0) {
if(!skip_pkt_rrs(c->buffer,
((int)LDNS_ANCOUNT(sldns_buffer_begin(c->buffer)))+
((int)LDNS_NSCOUNT(sldns_buffer_begin(c->buffer))))) {
LDNS_RCODE_SET(sldns_buffer_begin(c->buffer),
LDNS_RCODE_FORMERR);
sldns_buffer_flip(c->buffer);
return 1;
}
}
/* Do we have a valid OPT RR here? If not return FORMERR */
/* domain name must be the root of length 1. */
if(pkt_dname_len(c->buffer) != 1) {
LDNS_RCODE_SET(sldns_buffer_begin(c->buffer),
LDNS_RCODE_FORMERR);
return 1;
}
if(sldns_buffer_remaining(c->buffer) < 2 ||
sldns_buffer_read_u16(c->buffer) != LDNS_RR_TYPE_OPT) {
LDNS_RCODE_SET(sldns_buffer_begin(c->buffer),
LDNS_RCODE_FORMERR);
sldns_buffer_flip(c->buffer);
return 1;
}
/* Write OPT RR directly after the query,
* so without the (possibly skipped) Answer and NS RRs
*/
LDNS_ANCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
LDNS_NSCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
sldns_buffer_set_position(c->buffer, opt_rr_mark);

/* Check if OPT record can be written
* 17 == root label (1) + RR type (2) + UDP Size (2)
* + Fields (4) + rdata len (2) + EDE Option code (2)
* + EDE Option length (2) + EDE info-code (2)
*/
if (sldns_buffer_available(c->buffer, 17) == 0) {
LDNS_ARCOUNT_SET(sldns_buffer_begin(c->buffer), 0);
sldns_buffer_flip(c->buffer);
return 1;
}

LDNS_ARCOUNT_SET(sldns_buffer_begin(c->buffer), 1);

/* root label */
sldns_buffer_write_u8(c->buffer, 0);
sldns_buffer_write_u16(c->buffer, LDNS_RR_TYPE_OPT);
sldns_buffer_write_u16(c->buffer, EDNS_ADVERTISED_SIZE);

/* write OPT Record TTL Field */
sldns_buffer_write_u32(c->buffer, 0);

/* write rdata len: EDE option + length + info-code */
sldns_buffer_write_u16(c->buffer, 6);

/* write OPTIONS; add EDE option code */
sldns_buffer_write_u16(c->buffer, LDNS_EDNS_EDE);

/* write single EDE option length (for just 1 info-code) */
sldns_buffer_write_u16(c->buffer, 2);

/* write single EDE info-code */
sldns_buffer_write_u16(c->buffer, LDNS_EDE_PROHIBITED);

sldns_buffer_flip(c->buffer);

return 1;

}

return -1;
Expand Down Expand Up @@ -1382,12 +1500,15 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
* ACLs allow the snooping. */
if(!(LDNS_RD_WIRE(sldns_buffer_begin(c->buffer))) &&
acl != acl_allow_snoop ) {
EDNS_OPT_LIST_APPEND_EDE(&edns.opt_list_out,
worker->scratchpad, LDNS_EDE_NOT_AUTHORITATIVE, "");
error_encode(c->buffer, LDNS_RCODE_REFUSED, &qinfo,
*(uint16_t*)(void *)sldns_buffer_begin(c->buffer),
sldns_buffer_read_u16_at(c->buffer, 2), NULL);
sldns_buffer_read_u16_at(c->buffer, 2), &edns);
regional_free_all(worker->scratchpad);
log_addr(VERB_ALGO, "refused nonrec (cache snoop) query from",
&repinfo->addr, repinfo->addrlen);

goto send_reply;
}

Expand Down Expand Up @@ -1460,10 +1581,23 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
< *worker->env.now)
leeway = 0;
lock_rw_unlock(&e->lock);

// // stale answer?
// if (worker->env.cfg->serve_expired &&
// *worker->env.now >= ((struct reply_info*)e->data)->ttl) {
// // EDE Error Code 3 - Stale Answer
// EDNS_OPT_LIST_APPEND_EDE(&edns.opt_list_out, worker->scratchpad,
// LDNS_EDE_STALE_ANSWER, "");
// }

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I add commented about this earlier, but I don't seem to find that message again.
Is there any plan to have stale answers EDE handled from the get go of the RFC support?

// add EDNS struct?
reply_and_prefetch(worker, lookup_qinfo,
sldns_buffer_read_u16_at(c->buffer, 2),
repinfo, leeway,
(partial_rep || need_drop));



if(!partial_rep) {
rc = 0;
regional_free_all(worker->scratchpad);
Expand Down Expand Up @@ -1500,6 +1634,9 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
verbose(VERB_ALGO, "answer from the cache failed");
lock_rw_unlock(&e->lock);
}

// @TODO Extended DNS Error Code 13 - Cached Error? place not clear

if(!LDNS_RD_WIRE(sldns_buffer_begin(c->buffer))) {
if(answer_norec_from_cache(worker, &qinfo,
*(uint16_t*)(void *)sldns_buffer_begin(c->buffer),
Expand Down
71 changes: 61 additions & 10 deletions services/localzone.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,11 +1286,54 @@ local_encode(struct query_info* qinfo, struct module_env* env,
return 1;
}

/** encode answer consisting of 1 rrset (with EDE code) */
static int
local_encode_ede(struct query_info* qinfo, struct module_env* env,
struct edns_data* edns, struct comm_reply* repinfo, sldns_buffer* buf,
struct regional* temp, struct ub_packed_rrset_key* rrset, int ansec,
int rcode, sldns_ede_code ede_code, const char* ede_txt)
{
struct reply_info rep;
uint16_t udpsize;
/* make answer with time=0 for fixed TTL values */
memset(&rep, 0, sizeof(rep));
rep.flags = (uint16_t)((BIT_QR | BIT_AA | BIT_RA) | rcode);
rep.qdcount = 1;
if(ansec)
rep.an_numrrsets = 1;
else rep.ns_numrrsets = 1;
rep.rrset_count = 1;
rep.rrsets = &rrset;
udpsize = edns->udp_size;
edns->edns_version = EDNS_ADVERTISED_VERSION;
edns->udp_size = EDNS_ADVERTISED_SIZE;
edns->ext_rcode = 0;
edns->bits &= EDNS_DO;
if(!inplace_cb_reply_local_call(env, qinfo, NULL, &rep, rcode, edns,
repinfo, temp, env->now_tv)) {
error_encode(buf, (LDNS_RCODE_SERVFAIL|BIT_AA), qinfo,
*(uint16_t*)sldns_buffer_begin(buf),
sldns_buffer_read_u16_at(buf, 2), edns);
} else {
edns_opt_list_append_ede(&edns->opt_list_out, temp, ede_code, ede_txt);

if(!reply_info_answer_encode(qinfo, &rep,
*(uint16_t*)sldns_buffer_begin(buf), sldns_buffer_read_u16_at(buf, 2),
buf, 0, 0, temp, udpsize, edns, (int)(edns->bits&EDNS_DO), 0)) {
error_encode(buf, (LDNS_RCODE_SERVFAIL|BIT_AA), qinfo,
*(uint16_t*)sldns_buffer_begin(buf),
sldns_buffer_read_u16_at(buf, 2), edns);
}
}
return 1;
}

/** encode local error answer */
static void
local_error_encode(struct query_info* qinfo, struct module_env* env,
struct edns_data* edns, struct comm_reply* repinfo, sldns_buffer* buf,
struct regional* temp, int rcode, int r)
struct regional* temp, int rcode, int r, sldns_ede_code ede_code,
const char* ede_txt)
{
edns->edns_version = EDNS_ADVERTISED_VERSION;
edns->udp_size = EDNS_ADVERTISED_SIZE;
Expand All @@ -1300,6 +1343,8 @@ local_error_encode(struct query_info* qinfo, struct module_env* env,
if(!inplace_cb_reply_local_call(env, qinfo, NULL, NULL,
rcode, edns, repinfo, temp, env->now_tv))
edns->opt_list_inplace_cb_out = NULL;
if(ede_code >= 0 && env->cfg->local_data_do_ede)
edns_opt_list_append_ede(&edns->opt_list_out, temp, ede_code, ede_txt);
error_encode(buf, r, qinfo, *(uint16_t*)sldns_buffer_begin(buf),
sldns_buffer_read_u16_at(buf, 2), edns);
}
Expand Down Expand Up @@ -1495,9 +1540,11 @@ local_data_answer(struct local_zone* z, struct module_env* env,

if(newtargetlen > LDNS_MAX_DOMAINLEN) {
qinfo->local_alias = NULL;
local_error_encode(qinfo, env, edns, repinfo,
local_error_encode(qinfo, env, edns,repinfo,
buf, temp, LDNS_RCODE_YXDOMAIN,
(LDNS_RCODE_YXDOMAIN|BIT_AA));
(LDNS_RCODE_YXDOMAIN|BIT_AA),
LDNS_EDE_OTHER,
"DNAME expansion became too large");
return 1;
}
memset(&qinfo->local_alias->rrset->entry, 0,
Expand Down Expand Up @@ -1542,6 +1589,7 @@ local_data_answer(struct local_zone* z, struct module_env* env,
return local_encode(qinfo, env, edns, repinfo, buf, temp, &r, 1,
LDNS_RCODE_NOERROR);
}
// @TODO add EDE?
return local_encode(qinfo, env, edns, repinfo, buf, temp, lr->rrset, 1,
LDNS_RCODE_NOERROR);
}
Expand Down Expand Up @@ -1600,7 +1648,8 @@ local_zones_zone_answer(struct local_zone* z, struct module_env* env,
} else if(lz_type == local_zone_refuse
|| lz_type == local_zone_always_refuse) {
local_error_encode(qinfo, env, edns, repinfo, buf, temp,
LDNS_RCODE_REFUSED, (LDNS_RCODE_REFUSED|BIT_AA));
LDNS_RCODE_REFUSED, (LDNS_RCODE_REFUSED|BIT_AA),
LDNS_EDE_BLOCKED, "");
return 1;
} else if(lz_type == local_zone_static ||
lz_type == local_zone_redirect ||
Expand All @@ -1625,8 +1674,8 @@ local_zones_zone_answer(struct local_zone* z, struct module_env* env,
if(z != NULL && z->soa && z->soa_negative)
return local_encode(qinfo, env, edns, repinfo, buf, temp,
z->soa_negative, 0, rcode);
local_error_encode(qinfo, env, edns, repinfo, buf, temp, rcode,
(rcode|BIT_AA));
local_error_encode(qinfo, env, edns, repinfo, buf, temp,
rcode, (rcode|BIT_AA), LDNS_EDE_BLOCKED, "");
return 1;
} else if(lz_type == local_zone_typetransparent
|| lz_type == local_zone_always_transparent) {
Expand Down Expand Up @@ -1664,12 +1713,13 @@ local_zones_zone_answer(struct local_zone* z, struct module_env* env,
d.rr_len = &rr_len;
d.rr_data = &rr_datas;
d.rr_ttl = &rr_ttl;
return local_encode(qinfo, env, edns, repinfo, buf, temp,
&lrr, 1, LDNS_RCODE_NOERROR);
return local_encode_ede(qinfo, env, edns, repinfo, buf, temp,
&lrr, 1, LDNS_RCODE_NOERROR, LDNS_EDE_FORGED_ANSWER, "");
} else {
/* NODATA: No EDE needed */
local_error_encode(qinfo, env, edns, repinfo, buf,
temp, LDNS_RCODE_NOERROR,
(LDNS_RCODE_NOERROR|BIT_AA));
(LDNS_RCODE_NOERROR|BIT_AA), -1, NULL);
}
return 1;
}
Expand All @@ -1682,8 +1732,9 @@ local_zones_zone_answer(struct local_zone* z, struct module_env* env,
if(z != NULL && z->soa && z->soa_negative)
return local_encode(qinfo, env, edns, repinfo, buf, temp,
z->soa_negative, 0, rcode);
/* NODATA: No EDE needed */
local_error_encode(qinfo, env, edns, repinfo, buf, temp, rcode,
(rcode|BIT_AA));
(rcode|BIT_AA), -1, NULL);
return 1;
}

Expand Down
17 changes: 17 additions & 0 deletions services/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,22 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
&r->edns, &r->query_reply, m->s.region, &r->start_time))
r->edns.opt_list_inplace_cb_out = NULL;
}
/* Send along EDE BOGUS EDNS0 option when answer is bogus */
if(rcode == LDNS_RCODE_SERVFAIL &&
m->s.env->need_to_validate && (!(r->qflags&BIT_CD) ||
m->s.env->cfg->ignore_cd) && rep &&
(rep->security <= sec_status_bogus ||
rep->security == sec_status_secure_sentinel_fail)) {

char *reason = m->s.env->cfg->val_log_level >= 2
? errinf_to_str_bogus(&m->s) : NULL;
sldns_ede_code reason_bogus = rep->reason_bogus != LDNS_EDE_DNSSEC_BOGUS
? rep->reason_bogus : errinf_to_reason_bogus(&m->s);

edns_opt_list_append_ede(&r->edns.opt_list_out, m->s.region,
reason_bogus, reason);
free(reason);
}
error_encode(r_buffer, rcode, &m->s.qinfo, r->qid,
r->qflags, &r->edns);
m->reply_list = NULL;
Expand All @@ -1313,6 +1329,7 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
if(!inplace_cb_reply_servfail_call(m->s.env, &m->s.qinfo, &m->s,
rep, LDNS_RCODE_SERVFAIL, &r->edns, &r->query_reply, m->s.region, &r->start_time))
r->edns.opt_list_inplace_cb_out = NULL;
// @TODO EDE?
error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
&m->s.qinfo, r->qid, r->qflags, &r->edns);
}
Expand Down
Loading