]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: update drs->lost before calling on_ack_recv
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 28 May 2026 15:41:30 +0000 (17:41 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Thu, 28 May 2026 15:47:31 +0000 (17:47 +0200)
The QUIC congestion control algorithm impacted by this bug is BBR.

In qc_notify_cc_of_newly_acked_pkts(), drs->lost was updated after
quic_cc_drs_on_ack_recv(), causing the current sample's lost count to
miss the bytes_lost from the current loss detection round. This meant
that rs->lost = drs->lost - rs->prior_lost would always be 0 for the
current losses, since both drs->lost and rs->prior_lost (captured at
packet send time) excluded the current bytes_lost.

Moving drs->lost += bytes_lost before on_ack_recv ensures that the
rate sample correctly includes the newly detected lost bytes, matching
the BBR algorithm's intent where C.delta_lost = C.lost - C.prior_lost
should reflect all losses since the last sample.

Must be backported as far as 3.1 where delivery rate sampling was
implemented.

src/quic_rx.c

index 121780108b76fc20c9fb6ff5877aa616ccfd7a7c..e0dd4036efbce14cfdb8b34313a93a0c13a59a7b 100644 (file)
@@ -468,8 +468,8 @@ static void qc_notify_cc_of_newly_acked_pkts(struct quic_conn *qc,
        }
 
        if (drs) {
-               quic_cc_drs_on_ack_recv(drs, p, pkt_delivered);
                drs->lost += bytes_lost;
+               quic_cc_drs_on_ack_recv(drs, p, pkt_delivered);
        }
        if (p->cc.algo->on_ack_rcvd)
                p->cc.algo->on_ack_rcvd(&p->cc, bytes_delivered, pkt_delivered,