From: Frederic Lecaille Date: Thu, 28 May 2026 15:41:30 +0000 (+0200) Subject: BUG/MINOR: quic: update drs->lost before calling on_ack_recv X-Git-Tag: v3.4.0~61 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=6599dd7d41208ea1f5a8479210085b678c736b44;p=thirdparty%2Fhaproxy.git BUG/MINOR: quic: update drs->lost before calling on_ack_recv 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. --- diff --git a/src/quic_rx.c b/src/quic_rx.c index 121780108..e0dd4036e 100644 --- a/src/quic_rx.c +++ b/src/quic_rx.c @@ -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,