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 <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.
This commit is contained in:
Frederic Lecaille 2025-07-31 15:14:30 +02:00
parent ac1d3eba88
commit a4bbbc75db
3 changed files with 9 additions and 8 deletions

View File

@ -71,7 +71,8 @@ struct quic_conn *qc_new_conn(const struct quic_version *qv, int ipv4,
struct sockaddr_storage *local_addr,
struct sockaddr_storage *peer_addr,
int token, void *owner);
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);

View File

@ -485,22 +485,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;
@ -575,7 +575,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;
@ -626,7 +626,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 */

View File

@ -528,7 +528,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);
}