From: Frédéric Lécaille Date: Thu, 27 May 2021 12:57:09 +0000 (+0200) Subject: MINOR: quic: Move an SSL func call from QUIC I/O handler to the xprt init. X-Git-Tag: v2.5-dev8~138 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e1aad4ff44eee492a17929faabbf561291c15e1;p=thirdparty%2Fhaproxy.git MINOR: quic: Move an SSL func call from QUIC I/O handler to the xprt init. Move the call to SSL_set_quic_transport_params() from the listener I/O dgram handler to the ->init() callback of the xprt (qc_conn_init()) which initializes its context where is stored the SSL context itself, needed by SSL_set_quic_transport_params(). Furthermore this is already what is done for the server counterpart of ->init() QUIC xprt callback. As the ->init() may be run by another thread than the one for the I/O handler, the xprt context could not be potentially already initialized before calling SSL_set_quic_transport_params() from the I/O handler. --- diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 327c3ce3a6..633767a1a2 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -3280,8 +3280,6 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end, /* This is the DCID node sent in this packet by the client. */ node = &qc->odcid_node; conn_ctx = qc->conn->xprt_ctx; - SSL_set_quic_transport_params(conn_ctx->ssl, - qc->enc_params, qc->enc_params_len); } else { if (pkt->type == QUIC_PACKET_TYPE_INITIAL && cids == &l->rx.odcids) @@ -4388,6 +4386,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx) else if (objt_listener(conn->target)) { /* Listener */ struct bind_conf *bc = __objt_listener(conn->target)->bind_conf; + struct quic_conn *qc = ctx->conn->qc; ctx->state = QUIC_HS_ST_SERVER_INITIAL; @@ -4395,6 +4394,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx) &ctx->ssl, &ctx->bio, ha_quic_meth, ctx) == -1) goto err; + SSL_set_quic_transport_params(ctx->ssl, qc->enc_params, qc->enc_params_len); SSL_set_accept_state(ctx->ssl); }