]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix that fixes the Fix that spoolbuf is not used to store tcp
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 11 Jun 2019 10:15:43 +0000 (12:15 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 11 Jun 2019 10:15:43 +0000 (12:15 +0200)
  pipelined response between mesh send and callback end, this fixes
  error cases that did not use the correct spoolbuf.

doc/Changelog
services/listen_dnsport.c
services/mesh.c

index 88f2c6f0893c2c0df0d43ea7d7d029e0c5c2f540..db04fce019b4515481ddec60103695a2d5e432ff 100644 (file)
@@ -1,3 +1,8 @@
+11 June 2019: Wouter
+       - Fix that fixes the Fix that spoolbuf is not used to store tcp
+         pipelined response between mesh send and callback end, this fixes
+         error cases that did not use the correct spoolbuf.
+
 6 June 2019: Wouter
        - 1.9.2rc1 release candidate tag.
 
index 6bada3577e355d3e78d45dc7516ba1591b701c7b..7e2afd843be8d8f5a6242754b31de93407ea64d6 100644 (file)
@@ -1752,6 +1752,7 @@ tcp_req_info_handle_readdone(struct tcp_req_info* req)
        req->is_drop = 0;
        req->is_reply = 0;
        req->in_worker_handle = 1;
+       sldns_buffer_set_limit(req->spool_buffer, 0);
        /* handle the current request */
        /* this calls the worker handle request routine that could give
         * a cache response, or localdata response, or drop the reply,
index 3dda0f6c6d358adc86c706d76938cfe1b6e9e883..59ee9a08ec0e93f20e2d64443c0550cfd6878b39 100644 (file)
@@ -354,6 +354,10 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
        int was_detached = 0;
        int was_noreply = 0;
        int added = 0;
+       struct sldns_buffer* r_buffer = rep->c->buffer;
+       if(rep->c->tcp_req_info) {
+               r_buffer = rep->c->tcp_req_info->spool_buffer;
+       }
        if(!unique)
                s = mesh_area_find(mesh, cinfo, qinfo, qflags&(BIT_RD|BIT_CD), 0, 0);
        /* does this create a new reply state? */
@@ -389,7 +393,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
                        if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, NULL, NULL,
                                LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch))
                                        edns->opt_list = NULL;
-                       error_encode(rep->c->buffer, LDNS_RCODE_SERVFAIL,
+                       error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
                                qinfo, qid, qflags, edns);
                        comm_point_send_reply(rep);
                        return;
@@ -405,7 +409,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
                                if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, NULL,
                                        NULL, LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch))
                                                edns->opt_list = NULL;
-                               error_encode(rep->c->buffer, LDNS_RCODE_SERVFAIL,
+                               error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
                                        qinfo, qid, qflags, edns);
                                comm_point_send_reply(rep);
                                return;
@@ -434,7 +438,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
                        if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, &s->s,
                                NULL, LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch))
                                        edns->opt_list = NULL;
-                       error_encode(rep->c->buffer, LDNS_RCODE_SERVFAIL,
+                       error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
                                qinfo, qid, qflags, edns);
                        comm_point_send_reply(rep);
                        if(added)