Skip to content
Snippets Groups Projects
Verified Commit 33f431fd authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

cache: shorten repetitive `qry->flags` blocks

parent 5565a1b7
Branches
Tags
1 merge request!600NSEC3 aggressive caching
......@@ -210,15 +210,16 @@ int answer_from_pkt(kr_layer_t *ctx, knot_pkt_t *pkt, uint16_t type,
}
/* Finishing touches. TODO: perhaps factor out */
qry->flags.EXPIRING = is_expiring(eh->ttl, new_ttl);
qry->flags.CACHED = true;
qry->flags.NO_MINIMIZE = true;
qry->flags.DNSSEC_INSECURE = kr_rank_test(eh->rank, KR_RANK_INSECURE);
qry->flags.DNSSEC_BOGUS = kr_rank_test(eh->rank, KR_RANK_BOGUS);
if (qry->flags.DNSSEC_INSECURE || qry->flags.DNSSEC_BOGUS) {
qry->flags.DNSSEC_WANT = false;
struct kr_qflags * const qf = &qry->flags;
qf->EXPIRING = is_expiring(eh->ttl, new_ttl);
qf->CACHED = true;
qf->NO_MINIMIZE = true;
qf->DNSSEC_INSECURE = kr_rank_test(eh->rank, KR_RANK_INSECURE);
qf->DNSSEC_BOGUS = kr_rank_test(eh->rank, KR_RANK_BOGUS);
if (qf->DNSSEC_INSECURE || qf->DNSSEC_BOGUS) {
qf->DNSSEC_WANT = false;
}
qry->flags.DNSSEC_OPTOUT = eh->has_optout;
qf->DNSSEC_OPTOUT = eh->has_optout;
VERBOSE_MSG(qry, "=> satisfied by exact packet: rank 0%.2o, new TTL %d\n",
eh->rank, new_ttl);
return kr_ok();
......
......@@ -285,10 +285,12 @@ int peek_nosync(kr_layer_t *ctx, knot_pkt_t *pkt)
? "+" : "-");
}
kr_log_verbose("\n");
/* Finishing touches. */
qry->flags.EXPIRING = expiring;
qry->flags.CACHED = true;
qry->flags.NO_MINIMIZE = true;
struct kr_qflags * const qf = &qry->flags;
qf->EXPIRING = expiring;
qf->CACHED = true;
qf->NO_MINIMIZE = true;
return KR_STATE_DONE;
}
......@@ -409,13 +411,15 @@ static int answer_simple_hit(kr_layer_t *ctx, knot_pkt_t *pkt, uint16_t type,
/* Put links to the materialized data into the pkt. */
ret = pkt_append(pkt, &ans.rrsets[AR_ANSWER], eh->rank);
CHECK_RET(ret);
/* Finishing touches. */
qry->flags.EXPIRING = is_expiring(eh->ttl, new_ttl);
qry->flags.CACHED = true;
qry->flags.NO_MINIMIZE = true;
qry->flags.DNSSEC_INSECURE = kr_rank_test(eh->rank, KR_RANK_INSECURE);
if (qry->flags.DNSSEC_INSECURE) {
qry->flags.DNSSEC_WANT = false;
struct kr_qflags * const qf = &qry->flags;
qf->EXPIRING = is_expiring(eh->ttl, new_ttl);
qf->CACHED = true;
qf->NO_MINIMIZE = true;
qf->DNSSEC_INSECURE = kr_rank_test(eh->rank, KR_RANK_INSECURE);
if (qf->DNSSEC_INSECURE) {
qf->DNSSEC_WANT = false;
}
VERBOSE_MSG(qry, "=> satisfied by exact %s: rank 0%.2o, new TTL %d\n",
(type == KNOT_RRTYPE_CNAME ? "CNAME" : "RRset"),
......
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