From 21564be4a2ca209580bbe644b43e758f2536a0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Thu, 2 Mar 2023 11:53:43 +0100 Subject: [PATCH] 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. --- src/quic_conn.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/quic_conn.c b/src/quic_conn.c index 85513bc86..7c2ee6492 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); }