From: W.C.A. Wijngaards Date: Tue, 30 Jun 2020 13:48:11 +0000 (+0200) Subject: - Also move reply list clean for mesh callbacks to the scrip callback X-Git-Tag: release-1.11.0~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f0c2956ac8834a1854fb1e811983d23d3ef0f92;p=thirdparty%2Funbound.git - Also move reply list clean for mesh callbacks to the scrip callback can see the reply_info. - Fix for mesh accounting if the reply list already empty to begin with. --- diff --git a/doc/Changelog b/doc/Changelog index 197e4b29b..64e1f50aa 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,10 @@ 29 June 2020: Wouter - Move reply list clean for serve expired mesh callback to after the reply is sent, so that script callbacks have reply_info. + - Also move reply list clean for mesh callbacks to the scrip callback + can see the reply_info. + - Fix for mesh accounting if the reply list already empty to begin + with. 24 June 2020: Wouter - iana portlist updated. diff --git a/services/mesh.c b/services/mesh.c index 223414415..b5d4aeeab 100644 --- a/services/mesh.c +++ b/services/mesh.c @@ -1320,26 +1320,7 @@ void mesh_query_done(struct mesh_state* mstate) free(err); } } - 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++; - } + reply_list = mstate->reply_list; 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. */ @@ -1381,6 +1362,17 @@ void mesh_query_done(struct mesh_state* mstate) prev_buffer = r_buffer; } } + if(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++; + } mstate->replies_sent = 1; while((c = mstate->cb_list) != NULL) { /* take this cb off the list; so that the list can be @@ -1992,12 +1984,14 @@ mesh_serve_expired_callback(void* arg) mesh->ans_expired++; } - mstate->reply_list = NULL; - if(!mstate->reply_list && !mstate->cb_list && r) { - log_assert(mesh->num_reply_states > 0); - mesh->num_reply_states--; - if(mstate->super_set.count == 0) { - mesh->num_detached_states++; + if(mstate->reply_list) { + mstate->reply_list = NULL; + if(!mstate->reply_list && !mstate->cb_list && r) { + log_assert(mesh->num_reply_states > 0); + mesh->num_reply_states--; + if(mstate->super_set.count == 0) { + mesh->num_detached_states++; + } } } while((c = mstate->cb_list) != NULL) {