Commit 0d10b728 authored by Petr Špaček's avatar Petr Špaček

Merge branch 'cname-loop' into 'master'

iterate: be more precise when detecting CNAME loops

See merge request !307
parents a3306b09 ac92745d
......@@ -637,11 +637,10 @@ static int process_answer(knot_pkt_t *pkt, struct kr_request *req)
}
}
VERBOSE_MSG("<= cname chain, following\n");
/* Check if the same query was already resolved */
for (int i = 0; i < req->rplan.resolved.len; ++i) {
struct kr_query *q = req->rplan.resolved.at[i];
if (q->parent == query->parent &&
q->sclass == query->sclass &&
/* Check if the same query was followed in the same CNAME chain. */
for (const struct kr_query *q = query->cname_parent; q != NULL;
q = q->cname_parent) {
if (q->sclass == query->sclass &&
q->stype == query->stype &&
knot_dname_is_equal(q->sname, cname)) {
VERBOSE_MSG("<= cname chain loop\n");
......
......@@ -90,6 +90,7 @@ struct kr_query {
struct kr_layer_pickle *deferred;
uint32_t uid; /**< Query iteration number, unique within the kr_rplan. */
uint32_t forward_flags;
/** Pointer to the query that originated this one because of following a CNAME (or NULL). */
struct kr_query *cname_parent;
};
......
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