]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
WIP: TO CHECK!!! quic-be: Start asap the mux for 0-RTT
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 11 Sep 2025 16:20:47 +0000 (18:20 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Thu, 11 Sep 2025 16:26:21 +0000 (18:26 +0200)
The mux is created and woken up as soon as possible. This means as soon as
the TX early data encryption level keys are installed. These keys are
installed on the first SSL_do_handshake() call. This call is done as soon
as the connection is created.

This way the mux is able to send 0-RTT packets alongside Initial packets.

src/quic_ssl.c
src/xprt_quic.c

index f49bd2c2c4de23bb7a75db9f6cea26be6b0f374a..144878e114c715127435738c33b127f47e2dd79c 100644 (file)
@@ -978,7 +978,7 @@ int qc_ssl_do_hanshake(struct quic_conn *qc, struct ssl_sock_ctx *ctx)
                                goto err;
                        }
                }
-               else {
+               else if (qc->mux_state != QC_MUX_READY) {
                        const unsigned char *alpn;
                        size_t alpn_len;
 
index dbcbb4caf997d2b8bb60dfd3609480277c1d5de8..04b6424f2078fc98c8bfa812148cb3281fa45f9f 100644 (file)
@@ -152,7 +152,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
 /* Start the QUIC transport layer */
 static int qc_xprt_start(struct connection *conn, void *ctx)
 {
-       int ret = 0;
+       int ret = -1;
        struct quic_conn *qc;
 
        qc = conn->handle.qc;
@@ -167,7 +167,25 @@ static int qc_xprt_start(struct connection *conn, void *ctx)
                 * the SSL object.
                 */
                if (!qc_ssl_do_hanshake(qc, ctx))
-                       goto out;
+                       goto err;
+
+               if (qc->eel) {
+                       struct ssl_sock_ctx *ssl_ctx = ctx;
+
+                       /* Start the mux asap when early data encryption level is available. */
+                       conn->flags |= CO_FL_WAIT_XPRT;
+                       if (conn_create_mux(ssl_ctx->conn, NULL) < 0) {
+                               TRACE_ERROR("mux creation failed", QUIC_EV_CONN_IO_CB, qc, &qc->state);
+                               goto err;
+                       }
+
+                       ssl_ctx->conn->flags &= ~CO_FL_WAIT_XPRT;
+                       qc->mux_state = QC_MUX_READY;
+                       /* Wake up MUX after its creation. Operation similar to TLS+ALPN on
+                        * TCP stack.
+                        */
+                       ssl_ctx->conn->mux->wake(ssl_ctx->conn);
+               }
        }
 
        /* Schedule quic-conn to ensure post handshake frames are emitted. This
@@ -178,9 +196,12 @@ static int qc_xprt_start(struct connection *conn, void *ctx)
                tasklet_wakeup(qc->wait_event.tasklet);
 
        ret = 1;
out:
leave:
        TRACE_LEAVE(QUIC_EV_CONN_NEW, qc);
        return ret;
+ err:
+       TRACE_DEVEL("leaving on error", QUIC_EV_CONN_NEW, qc);
+       goto leave;
 }
 
 static struct ssl_sock_ctx *qc_get_ssl_sock_ctx(struct connection *conn)