]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix num_reply_addr counting in mesh and tcp drop due to size
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 6 Feb 2020 10:09:30 +0000 (11:09 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 6 Feb 2020 10:09:30 +0000 (11:09 +0100)
  after serve_stale commit.

doc/Changelog
services/mesh.c

index b1a25d55a11b7b6ea04629527a9d6225f15810e4..44bfffd7adb9494809314da426ef118bd2de18d6 100644 (file)
@@ -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
index bcd84278b6b472a377bce20c1619da92f063cdca..3e501e7825d26386347050645a0b7abe22cbf98a 100644 (file)
@@ -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 &&