From: Olivier Houchard Date: Wed, 29 Jul 2026 23:03:51 +0000 (+0200) Subject: MEDIUM: quic: Do not use another thread group's listener FD X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=62d6ed440e83996f360ea00cdd328c6352f835f6;p=thirdparty%2Fhaproxy.git MEDIUM: quic: Do not use another thread group's listener FD A datagram may be read by a thread of another group than the one owning the connection it is for, and with per-thread-group file descriptor tables, we can't assume that we can use that file descriptor, so find a more fitting one if needed. --- diff --git a/src/quic_rx.c b/src/quic_rx.c index 932058f0c..49db1f10e 100644 --- a/src/quic_rx.c +++ b/src/quic_rx.c @@ -2429,6 +2429,24 @@ int quic_dgram_parse(struct quic_dgram *dgram, struct quic_conn *from_qc, TRACE_ENTER(QUIC_EV_CONN_LPKT); + /* + * Make sure we have a usable file descriptor. When each thread + * group has its own file descriptor tables, we can't just assume + * we can use the current listener, so find a more fitting one if + * needed. + */ + if (li && (global.tune.options & GTUNE_NO_TG_FD_SHARING) && + li->rx.bind_tgroup != tgid) { + struct listener *l2; + + list_for_each_entry(l2, &li->bind_conf->listeners, by_bind) { + if (l2->rx.bind_tgroup == tgid) { + li = l2; + break; + } + } + } + pos = dgram->buf; end = pos + dgram->len; do { @@ -2458,7 +2476,8 @@ int quic_dgram_parse(struct quic_dgram *dgram, struct quic_conn *from_qc, pkt->flags |= QUIC_FL_RX_PACKET_DGRAM_FIRST; quic_rx_packet_refinc(pkt); - if (quic_rx_pkt_parse(from_qc, pkt, pos, end, dgram, o)) + if (quic_rx_pkt_parse(from_qc, pkt, pos, end, dgram, + li ? &li->obj_type : o)) goto next; /* Search quic-conn instance for first packet of the datagram.