From: Frédéric Lécaille Date: Thu, 27 Jan 2022 14:20:31 +0000 (+0100) Subject: MINOR: quic: Attach all the CIDs to the same connection X-Git-Tag: v2.6-dev1~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ea9463d470747ef4ee4e112f16b082f8abc55e6;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index 715b78978d..d8f23bd1ff 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 90a191661c..11fd33df69 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;