summaryrefslogtreecommitdiff
path: root/usr.sbin/unbound
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2016-09-06 13:56:10 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2016-09-06 13:56:10 +0000
commitfd194d56ec2bd851ec1a9a59fce28f734725e30f (patch)
treedb7155f20ad2a49f82dd0f4cad1ce2c5cf29389a /usr.sbin/unbound
parent567dddc529e756c436f5e77fe0f03e1b051b1ba0 (diff)
Backport unbound r3830/3831 from upstreadm, fixing an issue where it can
become unresponsive and need to be restarted following a connectivity outage. From Brad, ok florian@ r3831 | wouter | 2016-08-23 04:49:01 -0400 (Tue, 23 Aug 2016) | 3 lines - Fix #804: lower num_target_queries for iterator also for failed lookups. r3830 | wouter | 2016-08-23 04:30:12 -0400 (Tue, 23 Aug 2016) | 3 lines - Fix #804: unbound stops responding after outage. Fixes queries that attempt to wait for an empty list of subqueries.
Diffstat (limited to 'usr.sbin/unbound')
-rw-r--r--usr.sbin/unbound/iterator/iterator.c10
-rw-r--r--usr.sbin/unbound/services/mesh.c6
2 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/unbound/iterator/iterator.c b/usr.sbin/unbound/iterator/iterator.c
index 749fba6af63..1f5132b8282 100644
--- a/usr.sbin/unbound/iterator/iterator.c
+++ b/usr.sbin/unbound/iterator/iterator.c
@@ -216,6 +216,7 @@ error_supers(struct module_qstate* qstate, int id, struct module_qstate* super)
qstate->qinfo.qtype == LDNS_RR_TYPE_AAAA) {
/* mark address as failed. */
struct delegpt_ns* dpns = NULL;
+ super_iq->num_target_queries--;
if(super_iq->dp)
dpns = delegpt_find_ns(super_iq->dp,
qstate->qinfo.qname, qstate->qinfo.qname_len);
@@ -235,7 +236,6 @@ error_supers(struct module_qstate* qstate, int id, struct module_qstate* super)
log_err("out of memory adding missing");
}
dpns->resolved = 1; /* mark as failed */
- super_iq->num_target_queries--;
}
if(qstate->qinfo.qtype == LDNS_RR_TYPE_NS) {
/* prime failed to get delegation */
@@ -2659,6 +2659,10 @@ processTargetResponse(struct module_qstate* qstate, int id,
log_query_info(VERB_ALGO, "processTargetResponse", &qstate->qinfo);
log_query_info(VERB_ALGO, "processTargetResponse super", &forq->qinfo);
+ /* Tell the originating event that this target query has finished
+ * (regardless if it succeeded or not). */
+ foriq->num_target_queries--;
+
/* check to see if parent event is still interested (in orig name). */
if(!foriq->dp) {
verbose(VERB_ALGO, "subq: parent not interested, was reset");
@@ -2674,10 +2678,6 @@ processTargetResponse(struct module_qstate* qstate, int id,
return;
}
- /* Tell the originating event that this target query has finished
- * (regardless if it succeeded or not). */
- foriq->num_target_queries--;
-
/* if iq->query_for_pside_glue then add the pside_glue (marked lame) */
if(iq->pside_glue) {
/* if the pside_glue is NULL, then it could not be found,
diff --git a/usr.sbin/unbound/services/mesh.c b/usr.sbin/unbound/services/mesh.c
index 8f74cbe822b..b0434b3ff0c 100644
--- a/usr.sbin/unbound/services/mesh.c
+++ b/usr.sbin/unbound/services/mesh.c
@@ -1069,6 +1069,12 @@ mesh_continue(struct mesh_area* mesh, struct mesh_state* mstate,
*ev = module_event_pass;
return 1;
}
+ if(s == module_wait_subquery && mstate->sub_set.count == 0) {
+ log_err("module cannot wait for subquery, subquery list empty");
+ log_query_info(VERB_QUERY, "pass error for qstate",
+ &mstate->s.qinfo);
+ s = module_error;
+ }
if(s == module_error && mstate->s.return_rcode == LDNS_RCODE_NOERROR) {
/* error is bad, handle pass back up below */
mstate->s.return_rcode = LDNS_RCODE_SERVFAIL;