Skip to content
Snippets Groups Projects
Commit 350f7318 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

tests/test_integration: missing global OPT

parent 32f1e647
Branches
Tags
No related merge requests found
......@@ -225,7 +225,7 @@ static int edns_create(knot_pkt_t *pkt, knot_pkt_t *template, struct kr_request
{
pkt->opt_rr = knot_rrset_copy(req->ctx->opt_rr, &pkt->mm);
/* Set DO bit if set (DNSSEC requested). */
if (knot_pkt_has_dnssec(template)) {
if (knot_pkt_has_dnssec(template) || (req->options & QUERY_DNSSEC_WANT)) {
knot_edns_set_do(pkt->opt_rr);
}
return knot_pkt_reserve(pkt, knot_edns_wire_size(pkt->opt_rr));
......@@ -244,7 +244,7 @@ static int answer_prepare(knot_pkt_t *answer, knot_pkt_t *query, struct kr_reque
req->options |= QUERY_DNSSEC_WANT;
}
/* Handle EDNS in the query */
if (knot_pkt_has_edns(query)) {
if (knot_pkt_has_edns(query) || (req->options & QUERY_DNSSEC_WANT)) {
int ret = edns_create(answer, query, req);
if (ret != 0){
return ret;
......
......@@ -64,6 +64,8 @@ static PyObject* init(PyObject* self, PyObject* args)
memset(&global_context, 0, sizeof(struct kr_context));
global_context.pool = &global_mm;
global_context.modules = &global_modules;
global_context.opt_rr = mm_alloc(&global_mm, sizeof(knot_rrset_t));
knot_edns_init(global_context.opt_rr, KR_EDNS_PAYLOAD, 0, KR_EDNS_VERSION, &global_mm);
/* Create cache */
global_tmpdir = test_tmpdir_create();
......@@ -109,6 +111,7 @@ static PyObject* deinit(PyObject* self, PyObject* args)
lru_deinit(global_context.cache_rep);
free(global_context.cache_rtt);
free(global_context.cache_rep);
knot_rrset_free(&global_context.opt_rr, global_context.pool);
test_tmpdir_remove(global_tmpdir);
global_tmpdir = NULL;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment