BUG/MINOR: quic: Ensure not to retransmit packets with no ack-eliciting frames
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 2 Mar 2023 10:53:43 +0000 (11:53 +0100)
committerFrédéric Lécaille <flecaille@haproxy.com>
Fri, 3 Mar 2023 18:12:26 +0000 (19:12 +0100)
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

index 85513bc..7c2ee64 100644 (file)
@@ -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);
        }