CLEANUP: quic: Remove a useless check in qc_lstnr_pkt_rcv()
This function parses the QUIC packet from a UDP datagram. It was originally
supposed to be run by several thread. Here we remove a section of code
where the current thread checks there is not another thread which has already
inserted the new quic_conn it is trying to insert in the connections tree.
Must be backported to 2.6 to ease the future backports to come.
(cherry picked from commit 560ddfa003
)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
This commit is contained in:
committed by
Christopher Faulet
parent
2fd17a0d68
commit
aaf95c19f7
@ -5236,7 +5236,7 @@ static void qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
|
|||||||
struct quic_dgram *dgram, struct list **tasklist_head)
|
struct quic_dgram *dgram, struct list **tasklist_head)
|
||||||
{
|
{
|
||||||
unsigned char *beg, *payload;
|
unsigned char *beg, *payload;
|
||||||
struct quic_conn *qc, *qc_to_purge = NULL;
|
struct quic_conn *qc;
|
||||||
struct listener *l;
|
struct listener *l;
|
||||||
struct proxy *prx;
|
struct proxy *prx;
|
||||||
struct quic_counters *prx_counters;
|
struct quic_counters *prx_counters;
|
||||||
@ -5403,7 +5403,6 @@ static void qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
|
|||||||
qc = retrieve_qc_conn_from_cid(pkt, l, &dgram->saddr);
|
qc = retrieve_qc_conn_from_cid(pkt, l, &dgram->saddr);
|
||||||
if (!qc) {
|
if (!qc) {
|
||||||
int ipv4;
|
int ipv4;
|
||||||
struct ebmb_node *n = NULL;
|
|
||||||
|
|
||||||
if (pkt->type != QUIC_PACKET_TYPE_INITIAL) {
|
if (pkt->type != QUIC_PACKET_TYPE_INITIAL) {
|
||||||
TRACE_PROTO("Non Initial packet", QUIC_EV_CONN_LPKT);
|
TRACE_PROTO("Non Initial packet", QUIC_EV_CONN_LPKT);
|
||||||
@ -5442,32 +5441,12 @@ static void qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
|
|||||||
|
|
||||||
HA_ATOMIC_INC(&prx_counters->half_open_conn);
|
HA_ATOMIC_INC(&prx_counters->half_open_conn);
|
||||||
/* Insert the DCID the QUIC client has chosen (only for listeners) */
|
/* Insert the DCID the QUIC client has chosen (only for listeners) */
|
||||||
n = ebmb_insert(&quic_dghdlrs[tid].odcids, &qc->odcid_node,
|
ebmb_insert(&quic_dghdlrs[tid].odcids, &qc->odcid_node,
|
||||||
qc->odcid.len + qc->odcid.addrlen);
|
qc->odcid.len + qc->odcid.addrlen);
|
||||||
|
|
||||||
/* If the insertion failed, it means that another
|
|
||||||
* thread has already allocated a QUIC connection for
|
|
||||||
* the same CID. Liberate our allocated connection.
|
|
||||||
*/
|
|
||||||
if (unlikely(n != &qc->odcid_node)) {
|
|
||||||
qc_to_purge = qc;
|
|
||||||
|
|
||||||
qc = ebmb_entry(n, struct quic_conn, odcid_node);
|
|
||||||
pkt->qc = qc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (likely(!qc_to_purge)) {
|
|
||||||
/* Enqueue this packet. */
|
|
||||||
pkt->qc = qc;
|
pkt->qc = qc;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
quic_conn_release(qc_to_purge);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pkt->qc = qc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
if (end - buf < QUIC_HAP_CID_LEN) {
|
if (end - buf < QUIC_HAP_CID_LEN) {
|
||||||
TRACE_PROTO("Packet dropped", QUIC_EV_CONN_LPKT);
|
TRACE_PROTO("Packet dropped", QUIC_EV_CONN_LPKT);
|
||||||
|
Reference in New Issue
Block a user