diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index d33db3f53..b2531449d 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -946,18 +946,20 @@ void iter_merge_retry_counts(struct delegpt* dp, struct delegpt* old) } } prev = NULL; - a = dp->result_list; + a = dp->usable_list; while(a) { if(a->attempts >= OUTBOUND_MSG_RETRY) { + log_addr(VERB_ALGO, "remove from usable list dp", + &a->addr, a->addrlen); /* remove from result list */ if(prev) - prev->next_result = a->next_result; - else dp->result_list = a->next_result; + prev->next_usable = a->next_usable; + else dp->usable_list = a->next_usable; /* prev stays the same */ - a = a->next_result; + a = a->next_usable; continue; } prev = a; - a = a->next_result; + a = a->next_usable; } } diff --git a/iterator/iterator.c b/iterator/iterator.c index 10c078803..755a0e34f 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -1401,6 +1401,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq, /* if: no parent NS in cache - go up one level */ verbose(VERB_ALGO, "try to grab parent NS"); iq->store_parent_NS = 1; + iq->parent_NS_old_dp = iq->dp; iq->deleg_msg = NULL; iq->refetch_glue = 1; iq->query_restart_count++; @@ -1807,7 +1808,6 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, qstate->region); return final_state(iq); } else if(type == RESPONSE_TYPE_REFERRAL) { - struct delegpt* old_dp = iq->dp; /* REFERRAL type responses get a reset of the * delegation point, and back to the QUERYTARGETS_STATE. */ verbose(VERB_DETAIL, "query response was REFERRAL"); @@ -1865,8 +1865,8 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, qstate->region, iq->dp)) return error_response(qstate, id, LDNS_RCODE_SERVFAIL); if(iq->store_parent_NS && query_dname_compare(iq->dp->name, - old_dp->name) == 0) - iter_merge_retry_counts(iq->dp, old_dp); + iq->parent_NS_old_dp->name) == 0) + iter_merge_retry_counts(iq->dp, iq->parent_NS_old_dp); delegpt_log(VERB_ALGO, iq->dp); /* Count this as a referral. */ iq->referral_count++; diff --git a/iterator/iterator.h b/iterator/iterator.h index 407d6c598..a5c233d17 100644 --- a/iterator/iterator.h +++ b/iterator/iterator.h @@ -252,6 +252,8 @@ struct iter_qstate { * Enabled once it hits resolution problems, to throttle retries. */ int store_parent_NS; + /** the old delegation point with retry counts */ + struct delegpt* parent_NS_old_dp; /** * The query is for parent-side glue(A or AAAA) for a nameserver.