From: Frederic Lecaille Date: Wed, 10 Jan 2024 10:10:36 +0000 (+0100) Subject: MINOR: quic-be: Do not redispatch the datagrams X-Git-Tag: v3.3-dev2~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=266b10b8a4456f87fffdf2a3fca9e990fc9eeb5c;p=thirdparty%2Fhaproxy.git MINOR: quic-be: Do not redispatch the datagrams The QUIC datagram redispatch is there to counter the race condition which exists only for QUIC connections to listener where datagrams may arrive on the wrong socket between the bind() and connect() calls. Run this code part only for listeners. --- diff --git a/src/quic_sock.c b/src/quic_sock.c index 4cd9317cc..6aabb24a1 100644 --- a/src/quic_sock.c +++ b/src/quic_sock.c @@ -818,14 +818,12 @@ int qc_rcv_buf(struct quic_conn *qc) struct quic_dgram *new_dgram = NULL; struct buffer buf = BUF_NULL; unsigned char *dgram_buf; - struct listener *l; ssize_t ret = 0; /* Do not call this if quic-conn FD is uninitialized. */ BUG_ON(qc->fd < 0); TRACE_ENTER(QUIC_EV_CONN_RCV, qc); - l = qc->li; do { if (!b_alloc(&buf, DB_MUX_RX)) @@ -871,7 +869,7 @@ int qc_rcv_buf(struct quic_conn *qc) continue; } - if (!qc_check_dcid(qc, new_dgram->dcid, new_dgram->dcid_len)) { + if (qc_is_listener(qc) && !qc_check_dcid(qc, new_dgram->dcid, new_dgram->dcid_len)) { /* Datagram received by error on the connection FD, dispatch it * to its associated quic-conn. * @@ -881,6 +879,7 @@ int qc_rcv_buf(struct quic_conn *qc) struct quic_dgram *tmp_dgram; unsigned char *rxbuf_tail; size_t cspace; + struct listener *l = qc->li; TRACE_STATE("datagram for other connection on quic-conn socket, requeue it", QUIC_EV_CONN_RCV, qc);