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.
This commit is contained in:
Frédéric Lécaille 2022-01-27 15:20:31 +01:00 committed by Amaury Denoyelle
parent 320744b53d
commit 9ea9463d47
2 changed files with 6 additions and 3 deletions

View 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;

View 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;