Commit b9c99804 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

Merge !211: iterate: skip answer RRs that don't match the query

Fixes #160.
parents f3657197 09bb0d03
Pipeline #1903 passed with stages
in 1 minute and 9 seconds
......@@ -391,9 +391,18 @@ static int unroll_cname(knot_pkt_t *pkt, struct kr_request *req, bool referral,
pending_cname = NULL;
for (unsigned i = 0; i < an->count; ++i) {
const knot_rrset_t *rr = knot_pkt_rr(an, i);
if (!knot_dname_is_equal(rr->owner, cname)) {
/* Skip the RR if its owner+type doesn't interest us. */
const bool type_OK = rr->type == query->stype
|| rr->type == KNOT_RRTYPE_CNAME
|| rr->type == KNOT_RRTYPE_DNAME /* TODO: actually handle it */
|| (rr->type == KNOT_RRTYPE_RRSIG
&& knot_rrsig_type_covered(&rr->rrs, 0))
;
if (!type_OK || !knot_dname_is_equal(rr->owner, cname)) {
continue;
}
/* Process records matching current SNAME */
int state = KR_STATE_FAIL;
bool to_wire = false;
......
Markdown is supported
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