From: Frederic Lecaille Date: Thu, 31 Jul 2025 13:14:30 +0000 (+0200) Subject: MINOR: quic-be: Send post handshake frames from list of frames (0-RTT) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=26ab332eabd0efdf433d608b6d1d66f91be4817f;p=thirdparty%2Fhaproxy.git MINOR: quic-be: Send post handshake frames from list of frames (0-RTT) This patch is required to make 0-RTT work. It modifies the prototype of quic_build_post_handshake_frames() to send post handshake frames from a list of frames in place of the application encryption level (used as ael> local variable). This patch does not modify at all the current QUIC stack behavior (even for QUIC frontends). It must be considered as a preparation for the code to come about 0-RTT support for QUIC backends. --- diff --git a/include/haproxy/quic_conn.h b/include/haproxy/quic_conn.h index 9439bbd69..2cb200b58 100644 --- a/include/haproxy/quic_conn.h +++ b/include/haproxy/quic_conn.h @@ -72,7 +72,8 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4, struct sockaddr_storage *peer_addr, int token, void *owner, struct connection *conn); -int quic_build_post_handshake_frames(struct quic_conn *qc); +int quic_build_post_handshake_frames(struct quic_conn *qc, + struct list *to_frms_list); const struct quic_version *qc_supported_version(uint32_t version); int quic_peer_validated_addr(struct quic_conn *qc); void qc_set_timer(struct quic_conn *qc); diff --git a/src/quic_conn.c b/src/quic_conn.c index 67cbdda9c..408de6122 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -484,22 +484,22 @@ int quic_stateless_reset_token_cpy(unsigned char *pos, size_t len, return ret; } -/* Build all the frames which must be sent just after the handshake have succeeded. +/* Build all the frames which must be sent just after the handshake have succeeded + * for server, or asap for client (0-RTT). * This is essentially NEW_CONNECTION_ID frames. A QUIC server must also send * a HANDSHAKE_DONE frame. * Return 1 if succeeded, 0 if not. */ -int quic_build_post_handshake_frames(struct quic_conn *qc) +int quic_build_post_handshake_frames(struct quic_conn *qc, + struct list *to_frm_list) { int ret = 0, max = 0; - struct quic_enc_level *qel; struct quic_frame *frm, *frmbak; struct list frm_list = LIST_HEAD_INIT(frm_list); struct eb64_node *node; TRACE_ENTER(QUIC_EV_CONN_IO_CB, qc); - qel = qc->ael; /* Only servers must send a HANDSHAKE_DONE frame. */ if (!qc_is_back(qc)) { size_t new_token_frm_len; @@ -564,7 +564,7 @@ int quic_build_post_handshake_frames(struct quic_conn *qc) LIST_APPEND(&frm_list, &frm->list); } - LIST_SPLICE(&qel->pktns->tx.frms, &frm_list); + LIST_SPLICE(to_frm_list, &frm_list); qc->flags &= ~QUIC_FL_CONN_NEED_POST_HANDSHAKE_FRMS; ret = 1; @@ -615,7 +615,7 @@ struct task *quic_conn_app_io_cb(struct task *t, void *context, unsigned int sta */ if ((qc->flags & QUIC_FL_CONN_NEED_POST_HANDSHAKE_FRMS) && qc->conn && qc->state >= QUIC_HS_ST_COMPLETE) { - quic_build_post_handshake_frames(qc); + quic_build_post_handshake_frames(qc, &qc->ael->pktns->tx.frms); } /* Retranmissions */ diff --git a/src/quic_tx.c b/src/quic_tx.c index c3c81a9c3..5d7c20efc 100644 --- a/src/quic_tx.c +++ b/src/quic_tx.c @@ -529,7 +529,7 @@ enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms, /* Try to send post handshake frames first unless on 0-RTT. */ if ((qc->flags & QUIC_FL_CONN_NEED_POST_HANDSHAKE_FRMS) && qc->state >= QUIC_HS_ST_COMPLETE) { - quic_build_post_handshake_frames(qc); + quic_build_post_handshake_frames(qc, &qc->ael->pktns->tx.frms); qel_register_send(&send_list, qc->ael, &qc->ael->pktns->tx.frms); qc_send(qc, 0, &send_list, 0); }