From: Frédéric Lécaille Date: Thu, 2 Mar 2023 10:53:43 +0000 (+0100) Subject: BUG/MINOR: quic: Ensure not to retransmit packets with no ack-eliciting frames X-Git-Tag: v2.8-dev5~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21564be4a2ca209580bbe644b43e758f2536a0da;p=thirdparty%2Fhaproxy.git BUG/MINOR: quic: Ensure not to retransmit packets with no ack-eliciting frames Even if there is a check in callers of qc_prep_hdshk_fast_retrans() and qc_prep_fast_retrans() to prevent retransmissions of packets with no ack-eliciting frames, these two functions should pay attention not do to that especially if someone decides to modify their implementations in the future. Must be backported to 2.6 and 2.7. --- diff --git a/src/quic_conn.c b/src/quic_conn.c index 85513bc86a..7c2ee64921 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -2616,14 +2616,18 @@ static void qc_prep_fast_retrans(struct quic_conn *qc, node = eb64_first(pkts); start: while (node) { - pkt = eb64_entry(node, struct quic_tx_packet, pn_node); + struct quic_tx_packet *p; + + p = eb64_entry(node, struct quic_tx_packet, pn_node); node = eb64_next(node); /* Skip the empty and coalesced packets */ TRACE_PRINTF(TRACE_LEVEL_DEVELOPER, QUIC_EV_CONN_SPPKTS, qc, 0, 0, 0, - "--> pn=%llu (%d %d)", (ull)pkt->pn_node.key, - LIST_ISEMPTY(&pkt->frms), !!(pkt->flags & QUIC_FL_TX_PACKET_COALESCED)); - if (!LIST_ISEMPTY(&pkt->frms)) + "--> pn=%llu (%d %d)", (ull)p->pn_node.key, + LIST_ISEMPTY(&p->frms), !!(p->flags & QUIC_FL_TX_PACKET_COALESCED)); + if (!LIST_ISEMPTY(&p->frms)) { + pkt = p; break; + } } if (!pkt) @@ -2674,12 +2678,17 @@ static void qc_prep_hdshk_fast_retrans(struct quic_conn *qc, node = eb64_first(pkts); /* Skip the empty packet (they have already been retransmitted) */ while (node) { - pkt = eb64_entry(node, struct quic_tx_packet, pn_node); + struct quic_tx_packet *p; + + p = eb64_entry(node, struct quic_tx_packet, pn_node); TRACE_PRINTF(TRACE_LEVEL_DEVELOPER, QUIC_EV_CONN_SPPKTS, qc, 0, 0, 0, - "--> pn=%llu (%d %d)", (ull)pkt->pn_node.key, - LIST_ISEMPTY(&pkt->frms), !!(pkt->flags & QUIC_FL_TX_PACKET_COALESCED)); - if (!LIST_ISEMPTY(&pkt->frms) && !(pkt->flags & QUIC_FL_TX_PACKET_COALESCED)) + "--> pn=%llu (%d %d)", (ull)p->pn_node.key, + LIST_ISEMPTY(&p->frms), !!(p->flags & QUIC_FL_TX_PACKET_COALESCED)); + if (!LIST_ISEMPTY(&p->frms) && !(p->flags & QUIC_FL_TX_PACKET_COALESCED)) { + pkt = p; break; + } + node = eb64_next(node); }