From 9ea9463d470747ef4ee4e112f16b082f8abc55e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Thu, 27 Jan 2022 15:20:31 +0100 Subject: [PATCH] MINOR: quic: Attach all the CIDs to the same connection We copy the first octet of the original destination connection ID to any CID for the connection calling new_quic_cid(). So this patch modifies only this function to take a dcid as passed parameter. --- include/haproxy/xprt_quic.h | 5 ++++- src/xprt_quic.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index 715b78978..d8f23bd1f 100644 --- a/include/haproxy/xprt_quic.h +++ b/include/haproxy/xprt_quic.h @@ -183,7 +183,7 @@ static inline void quic_connection_id_to_frm_cpy(struct quic_frame *dst, */ static inline struct quic_connection_id *new_quic_cid(struct eb_root *root, struct quic_conn *qc, - int seq_num) + int seq_num, unsigned char *dcid) { struct quic_connection_id *cid; @@ -199,6 +199,9 @@ static inline struct quic_connection_id *new_quic_cid(struct eb_root *root, goto err; } + /* Set the same first octet from */ + cid->cid.data[0] = *dcid; + cid->qc = qc; cid->seq_num.key = seq_num; diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 90a191661..11fd33df6 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -2806,7 +2806,7 @@ static int quic_build_post_handshake_frames(struct quic_conn *qc) if (!frm) goto err; - cid = new_quic_cid(&qc->cids, qc, i); + cid = new_quic_cid(&qc->cids, qc, i, qc->scid.data); if (!cid) goto err; @@ -3609,7 +3609,7 @@ static struct quic_conn *qc_new_conn(unsigned int version, int ipv4, /* Initialize the output buffer */ qc->obuf.pos = qc->obuf.data; - icid = new_quic_cid(&qc->cids, qc, 0); + icid = new_quic_cid(&qc->cids, qc, 0, dcid); if (!icid) { TRACE_PROTO("Could not allocate a new connection ID", QUIC_EV_CONN_INIT, qc); goto err;