]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Attach all the CIDs to the same connection
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 27 Jan 2022 14:20:31 +0000 (15:20 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 27 Jan 2022 15:37:55 +0000 (16:37 +0100)
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
src/xprt_quic.c

index 715b78978db2ccad1f5cf9c60f40e48958a0e038..d8f23bd1ff1cd80fc42ca168a7ec79d02047e6cd 100644 (file)
@@ -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 <dcid> */
+       cid->cid.data[0] = *dcid;
+
        cid->qc = qc;
 
        cid->seq_num.key = seq_num;
index 90a191661c8dc73649ceca8c5a1e69934a39b158..11fd33df693d7de450543ee76933fa66dbd65721 100644 (file)
@@ -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;