]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic-be: Send post handshake frames from list of frames (0-RTT)
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 31 Jul 2025 13:14:30 +0000 (15:14 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Sat, 2 Aug 2025 08:53:39 +0000 (10:53 +0200)
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 <qc->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.

include/haproxy/quic_conn.h
src/quic_conn.c
src/quic_tx.c

index 7e6adf51d2100efb99870b7d3623a461ec304429..599153ab06800af5e15c6780037867c973b1afd6 100644 (file)
@@ -71,7 +71,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);
index ff61c2029314ea010a6d5beb882ebbc77ec6850e..4beee74dc29911759bda7d937f425486d682b246 100644 (file)
@@ -461,22 +461,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 (objt_listener(qc->target)) {
                size_t new_token_frm_len;
@@ -541,7 +541,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;
@@ -592,7 +592,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 */
index 27420260d723be9d58132a82c23ce6b9caf29ea7..c04884ee77561510e763324d067dd8a115583302 100644 (file)
@@ -508,7 +508,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);
        }