mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-11 03:31:36 +00:00
MINOR: quic: Possible wrong connection identification
A client may send several Initial packets. This is the case for picoquic with -Q option. In this case we must identify the connection of incoming Initial packets thanks to the original destination connection ID.
This commit is contained in:
parent
d169efe52b
commit
8370c93a03
@ -3729,30 +3729,36 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt->qc = qc;
|
|
||||||
/* This is the DCID node sent in this packet by the client. */
|
|
||||||
node = &qc->odcid_node;
|
|
||||||
/* Enqueue this packet. */
|
|
||||||
MT_LIST_APPEND(&l->rx.pkts, &pkt->rx_list);
|
|
||||||
/* Try to accept a new connection. */
|
|
||||||
listener_accept(l);
|
|
||||||
|
|
||||||
HA_RWLOCK_WRLOCK(QUIC_LOCK, &l->rx.cids_lock);
|
HA_RWLOCK_WRLOCK(QUIC_LOCK, &l->rx.cids_lock);
|
||||||
/* Insert the DCID the QUIC client has chosen (only for listeners) */
|
/* Insert the DCID the QUIC client has chosen (only for listeners) */
|
||||||
ebmb_insert(&l->rx.odcids, &qc->odcid_node, qc->odcid.len);
|
n = ebmb_insert(&l->rx.odcids, &qc->odcid_node, qc->odcid.len);
|
||||||
/* Insert our SCID, the connection ID for the QUIC client. */
|
if (n == &qc->odcid_node) {
|
||||||
n = ebmb_insert(&l->rx.cids, &qc->scid_node, qc->scid.len);
|
/* Insert our SCID, the connection ID for the QUIC client. */
|
||||||
HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &l->rx.cids_lock);
|
ebmb_insert(&l->rx.cids, &qc->scid_node, qc->scid.len);
|
||||||
if (n != &qc->scid_node) {
|
|
||||||
quic_conn_free(qc);
|
|
||||||
qc = ebmb_entry(n, struct quic_conn, scid_node);
|
|
||||||
}
|
}
|
||||||
|
HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &l->rx.cids_lock);
|
||||||
|
|
||||||
|
pkt->qc = qc;
|
||||||
|
if (n == &qc->odcid_node) {
|
||||||
|
/* Enqueue this packet. */
|
||||||
|
MT_LIST_APPEND(&l->rx.pkts, &pkt->rx_list);
|
||||||
|
/* Try to accept a new connection. */
|
||||||
|
listener_accept(l);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
quic_conn_free(qc);
|
||||||
|
qc = ebmb_entry(n, struct quic_conn, odcid_node);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is the DCID node sent in this packet by the client. */
|
||||||
|
node = &qc->odcid_node;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (pkt->type == QUIC_PACKET_TYPE_INITIAL && cids == &l->rx.odcids)
|
if (pkt->type == QUIC_PACKET_TYPE_INITIAL && cids == &l->rx.odcids)
|
||||||
qc = ebmb_entry(node, struct quic_conn, odcid_node);
|
qc = ebmb_entry(node, struct quic_conn, odcid_node);
|
||||||
else
|
else
|
||||||
qc = ebmb_entry(node, struct quic_conn, scid_node);
|
qc = ebmb_entry(node, struct quic_conn, scid_node);
|
||||||
|
pkt->qc = qc;
|
||||||
conn_ctx = qc->conn->xprt_ctx;
|
conn_ctx = qc->conn->xprt_ctx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3772,12 +3778,11 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end,
|
|||||||
qc = ebmb_entry(node, struct quic_conn, scid_node);
|
qc = ebmb_entry(node, struct quic_conn, scid_node);
|
||||||
conn_ctx = qc->conn->xprt_ctx;
|
conn_ctx = qc->conn->xprt_ctx;
|
||||||
*buf += QUIC_CID_LEN;
|
*buf += QUIC_CID_LEN;
|
||||||
|
pkt->qc = qc;
|
||||||
/* A short packet is the last one of an UDP datagram. */
|
/* A short packet is the last one of an UDP datagram. */
|
||||||
pkt->len = end - *buf;
|
pkt->len = end - *buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt->qc = qc;
|
|
||||||
|
|
||||||
/* Store the DCID used for this packet to check the packet which
|
/* Store the DCID used for this packet to check the packet which
|
||||||
* come in this UDP datagram match with it.
|
* come in this UDP datagram match with it.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user