]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: Possible skipped RTT sampling
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 29 Aug 2023 09:01:19 +0000 (11:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 4 Sep 2023 09:29:35 +0000 (11:29 +0200)
There are very few chances this bug may occur. Furthermore the consequences
are not dramatic: an RTT sampling may be ignored. I guess this may happen
when the now_ms global value wraps.

Do not rely on the time variable value a packet was sent to decide if it
is a newly acknowledged packet but on its presence or not in the tx packet
ebtree.

Must be backported as far as 2.6.

src/quic_rx.c

index 152bbe3ce141ce72b83dca914cc87108ff131fcc..dac448b28b682db18dea2a6f9b75bf6d8b02f472 100644 (file)
@@ -592,7 +592,7 @@ static int qc_parse_ack_frm(struct quic_conn *qc,
        unsigned int time_sent, pkt_flags;
        struct list newly_acked_pkts = LIST_HEAD_INIT(newly_acked_pkts);
        struct list lost_pkts = LIST_HEAD_INIT(lost_pkts);
-       int ret = 0;
+       int ret = 0, new_largest_acked_pn = 0;
 
        TRACE_ENTER(QUIC_EV_CONN_PRSAFRM, qc);
 
@@ -624,6 +624,7 @@ static int qc_parse_ack_frm(struct quic_conn *qc,
                else {
                        time_sent = eb64_entry(largest_node,
                                               struct quic_tx_packet, pn_node)->time_sent;
+                       new_largest_acked_pn = 1;
                }
        }
 
@@ -669,7 +670,7 @@ static int qc_parse_ack_frm(struct quic_conn *qc,
                            qc, NULL, &largest, &smallest);
        } while (1);
 
-       if (time_sent && (pkt_flags & QUIC_FL_TX_PACKET_ACK_ELICITING)) {
+       if (new_largest_acked_pn && (pkt_flags & QUIC_FL_TX_PACKET_ACK_ELICITING)) {
                *rtt_sample = tick_remain(time_sent, now_ms);
                qel->pktns->rx.largest_acked_pn = ack_frm->largest_ack;
        }