From: Christopher Faulet Date: Tue, 5 Nov 2019 15:49:23 +0000 (+0100) Subject: BUG/MEDIUM: stream: Be sure to support splicing at the mux level to enable it X-Git-Tag: v2.1-dev5~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=276c1e0533e77008445d57a1953f1f516d66877d;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: stream: Be sure to support splicing at the mux level to enable it Despite the addition of the mux layer, no change have been made on how to enable the TCP splicing on process_stream(). We still check if transport layer on both sides support the splicing, but we don't check the muxes support. So it is possible to start to splice data with an unencrypted H2 connection on a side and an H1 connection on the other. This leads to a freeze of the stream until a client or server timeout is reached. This patch fixed a part of the issue #356. It must be backported as far as 1.8. --- diff --git a/src/stream.c b/src/stream.c index 99e607da69..10d8004b6c 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2321,8 +2321,10 @@ struct task *process_stream(struct task *t, void *context, unsigned short state) if (!(req->flags & (CF_KERN_SPLICING|CF_SHUTR)) && req->to_forward && (global.tune.options & GTUNE_USE_SPLICE) && - (objt_cs(si_f->end) && __objt_cs(si_f->end)->conn->xprt && __objt_cs(si_f->end)->conn->xprt->rcv_pipe) && - (objt_cs(si_b->end) && __objt_cs(si_b->end)->conn->xprt && __objt_cs(si_b->end)->conn->xprt->snd_pipe) && + (objt_cs(si_f->end) && __objt_cs(si_f->end)->conn->xprt && __objt_cs(si_f->end)->conn->xprt->rcv_pipe && + __objt_cs(si_f->end)->conn->mux && __objt_cs(si_f->end)->conn->mux->rcv_pipe) && + (objt_cs(si_b->end) && __objt_cs(si_b->end)->conn->xprt && __objt_cs(si_b->end)->conn->xprt->snd_pipe && + __objt_cs(si_b->end)->conn->mux && __objt_cs(si_b->end)->conn->mux->snd_pipe) && (pipes_used < global.maxpipes) && (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_REQ) || (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) && @@ -2508,8 +2510,10 @@ struct task *process_stream(struct task *t, void *context, unsigned short state) if (!(res->flags & (CF_KERN_SPLICING|CF_SHUTR)) && res->to_forward && (global.tune.options & GTUNE_USE_SPLICE) && - (objt_cs(si_f->end) && __objt_cs(si_f->end)->conn->xprt && __objt_cs(si_f->end)->conn->xprt->snd_pipe) && - (objt_cs(si_b->end) && __objt_cs(si_b->end)->conn->xprt && __objt_cs(si_b->end)->conn->xprt->rcv_pipe) && + (objt_cs(si_f->end) && __objt_cs(si_f->end)->conn->xprt && __objt_cs(si_f->end)->conn->xprt->snd_pipe && + __objt_cs(si_f->end)->conn->mux && __objt_cs(si_f->end)->conn->mux->snd_pipe) && + (objt_cs(si_b->end) && __objt_cs(si_b->end)->conn->xprt && __objt_cs(si_b->end)->conn->xprt->rcv_pipe && + __objt_cs(si_b->end)->conn->mux && __objt_cs(si_b->end)->conn->mux->rcv_pipe) && (pipes_used < global.maxpipes) && (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_RTR) || (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) &&