From: Olivier Houchard Date: Fri, 23 Nov 2018 13:32:08 +0000 (+0100) Subject: BUG/MEDIUM: servers: Don't check if we have a conn_stream too soon. X-Git-Tag: v1.9-dev8~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1295016873ac4b0a2913549a2737cc95a7df2398;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: servers: Don't check if we have a conn_stream too soon. The creation of the conn_stream for an outgoing connection has been delayed a bit, and when using dispatch, a check was made to see if a conn_stream was attached before the conn_stream was created, so remove the test, as it's done later anyway, and create and install the conn_stream right away when we don't have a server, as is done when we don't have an alpn/npn defined. --- diff --git a/src/backend.c b/src/backend.c index 862fe3d8d3..3ab450bcb1 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1253,15 +1253,16 @@ int connect_server(struct stream *s) else if (obj_type(s->target) == OBJ_TYPE_PROXY) { /* proxies exclusively run on raw_sock right now */ conn_prepare(srv_conn, protocol_by_family(srv_conn->addr.to.ss_family), xprt_get(XPRT_RAW)); - if (!objt_cs(s->si[1].end) || !objt_cs(s->si[1].end)->conn->ctrl) + if (!(srv_conn->ctrl)) return SF_ERR_INTERNAL; } else return SF_ERR_INTERNAL; /* how did we get there ? */ #ifdef USE_OPENSSL - if ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || - srv->mux_proto) + if (!srv || + ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || + srv->mux_proto)) #endif { srv_cs = si_alloc_cs(&s->si[1], srv_conn);