]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: quic: add comments on CID code
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 24 Nov 2021 14:29:53 +0000 (15:29 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 25 Nov 2021 10:33:35 +0000 (11:33 +0100)
Add minor comment to explain how the CID are stored in the QUIC
connection.

include/haproxy/xprt_quic-t.h
include/haproxy/xprt_quic.h
src/xprt_quic.c

index e8c6f66e38356429ae6e5e1d77b6f1ee3588e7b3..ee7b19d3423fd4e59afcc2c6dfd68b1d6373b2c9 100644 (file)
@@ -246,7 +246,8 @@ extern struct pool_head *pool_head_quic_rx_packet;
 extern struct pool_head *pool_head_quic_tx_packet;
 extern struct pool_head *pool_head_quic_frame;
 
-/*
+/* QUIC connection id data.
+ *
  * This struct is used by ebmb_node structs as last member of flexible arrays.
  * So do not change the order of the member of quic_cid struct.
  * <data> member must be the first one.
@@ -627,10 +628,10 @@ struct quic_conn {
        struct ebmb_node odcid_node;
        struct quic_cid odcid;
 
-       struct quic_cid dcid;
+       struct quic_cid dcid; /* DCID of our endpoint - not updated whan a new DCID is used */
        struct ebmb_node scid_node;
-       struct quic_cid scid;
-       struct eb_root cids;
+       struct quic_cid scid; /* first SCID of our endpoint - not updated when a new SCID is used */
+       struct eb_root cids; /* tree of quic_connection_id - used to match a received packet DCID with a connection */
 
        struct quic_enc_level els[QUIC_TLS_ENC_LEVEL_MAX];
        struct quic_pktns pktns[QUIC_TLS_PKTNS_MAX];
index f033b66d08d05acddc6ac43acf2409f393d692b2..2b59c37a48732536832874520a525e1ac74b7b90 100644 (file)
@@ -181,6 +181,7 @@ static inline struct quic_connection_id *new_quic_cid(struct eb_root *root,
 
        cid->seq_num.key = seq_num;
        cid->retire_prior_to = 0;
+       /* insert the allocated CID in the quic_conn tree */
        eb64_insert(root, &cid->seq_num);
 
        return cid;
index d36eb468640f3db0209aee9401a717ecca4622ee..c5974052f333ccfc71500289d48b660546ef4de6 100644 (file)
@@ -3076,7 +3076,7 @@ static struct quic_conn *qc_new_conn(unsigned int version, int ipv4,
                if (qc->odcid.len)
                        memcpy(qc->odcid.data, dcid, dcid_len);
 
-               /* Copy the SCID as our DCID for this connection. */
+               /* copy the packet SCID to reuse it as DCID for sending */
                if (scid_len)
                        memcpy(qc->dcid.data, scid, scid_len);
                qc->dcid.len = scid_len;