From: W.C.A. Wijngaards Date: Thu, 6 Feb 2020 10:09:30 +0000 (+0100) Subject: - Fix num_reply_addr counting in mesh and tcp drop due to size X-Git-Tag: release-1.10.0rc1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af7abd4dfd5932dddf5f56ea4615d13b462d6c4c;p=thirdparty%2Funbound.git - Fix num_reply_addr counting in mesh and tcp drop due to size after serve_stale commit. --- diff --git a/doc/Changelog b/doc/Changelog index b1a25d55a..44bfffd7a 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +6 February 2020: Wouter + - Fix num_reply_addr counting in mesh and tcp drop due to size + after serve_stale commit. + 5 February 2020: George - Added serve-stale functionality as described in draft-ietf-dnsop-serve-stale-10. `serve-expired-*` options can be used diff --git a/services/mesh.c b/services/mesh.c index bcd84278b..3e501e782 100644 --- a/services/mesh.c +++ b/services/mesh.c @@ -1307,7 +1307,7 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep, void mesh_query_done(struct mesh_state* mstate) { - struct mesh_reply* r; + struct mesh_reply* r, *reply_list = NULL; struct mesh_reply* prev = NULL; struct sldns_buffer* prev_buffer = NULL; struct mesh_cb* c; @@ -1331,7 +1331,27 @@ void mesh_query_done(struct mesh_state* mstate) free(err); } } - for(r = mstate->reply_list; r; r = r->next) { + if(mstate->reply_list) { + /* set the reply_list to NULL during the mesh_query_done + * processing, so that calls back into the mesh from + * tcp_req_info (deciding to drop the reply and thus + * unregister the mesh_reply from the mstate) are stopped + * because the list is empty. + * The mstate is then likely not a reply_state, and maybe + * also a detached_state. + */ + reply_list = mstate->reply_list; + mstate->reply_list = NULL; + if(!mstate->reply_list && !mstate->cb_list) { + /* was a reply state, not anymore */ + log_assert(mstate->s.env->mesh->num_reply_states > 0); + mstate->s.env->mesh->num_reply_states--; + } + if(!mstate->reply_list && !mstate->cb_list && + mstate->super_set.count == 0) + mstate->s.env->mesh->num_detached_states++; + } + for(r = reply_list; r; r = r->next) { /* if a response-ip address block has been stored the * information should be logged for each client. */ if(mstate->s.respip_action_info &&