From: Olivier Houchard Date: Tue, 26 May 2020 23:26:06 +0000 (+0200) Subject: BUG/MEDIUM: backend: set the connection owner to the session when using alpn. X-Git-Tag: v2.2-dev9~187 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68ad53cb3781010ccde7c781b6a3a1e926b5ed23;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: backend: set the connection owner to the session when using alpn. In connect_server(), if we can't create the mux immediately because we have to wait until the alpn is negociated, store the session as the connection's owner. conn_create_mux() expects it to be set, and provides it to the mux init() method. Failure to do so will result to crashes later if the connection is private, and even if we didn't do so it would prevent connection reuse for private connections. This should fix github issue #651. --- diff --git a/src/backend.c b/src/backend.c index 2a59247304..ba968198e8 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1407,6 +1407,10 @@ int connect_server(struct stream *s) srv->mux_proto || s->be->mode != PR_MODE_HTTP)) #endif init_mux = 1; +#if defined(USE_OPENSSL) && defined(TLSEXT_TYPE_application_layer_protocol_negotiation) + else + srv_conn->owner = s->sess; +#endif /* process the case where the server requires the PROXY protocol to be sent */ srv_conn->send_proxy_ofs = 0;