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.
This commit is contained in:
Frederic Lecaille 2024-01-10 11:10:36 +01:00 committed by Amaury Denoyelle
parent 89d5a59933
commit 266b10b8a4

View File

@ -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);