1 diff --git a/iterator/iterator.c b/iterator/iterator.c
2 index 7f3c6573..26660059 100644
3 --- a/iterator/iterator.c
4 +++ b/iterator/iterator.c
5 @@ -1157,6 +1157,13 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
6 if(iq->query_restart_count > MAX_RESTART_COUNT) {
7 verbose(VERB_QUERY, "request has exceeded the maximum number"
8 " of query restarts with %d", iq->query_restart_count);
10 + /* return the partial CNAME loop, i.e. with the
11 + * actual packet in iq->response cleared of RRsets,
12 + * the stored prepend RRsets contain the loop contents
13 + * with duplicates removed */
14 + return next_state(iq, FINISHED_STATE);
16 return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
19 @@ -1246,6 +1253,10 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
20 iq->qchase.qname_len = slen;
21 /* This *is* a query restart, even if it is a cheap
23 + msg->rep->an_numrrsets = 0;
24 + msg->rep->ns_numrrsets = 0;
25 + msg->rep->ar_numrrsets = 0;
26 + msg->rep->rrset_count = 0;
29 iq->query_restart_count++;
30 @@ -2739,6 +2750,10 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
31 if (qstate->env->cfg->qname_minimisation)
32 iq->minimisation_state = INIT_MINIMISE_STATE;
33 /* Clear the query state, since this is a query restart. */
34 + iq->response->rep->an_numrrsets = 0;
35 + iq->response->rep->ns_numrrsets = 0;
36 + iq->response->rep->ar_numrrsets = 0;
37 + iq->response->rep->rrset_count = 0;
40 iq->dsns_point = NULL;