From 3c90c1ce6b42ab53553ff06fc83781d4327825dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Tue, 29 Aug 2023 11:01:19 +0200 Subject: [PATCH] BUG/MINOR: quic: Possible skipped RTT sampling 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/quic_rx.c b/src/quic_rx.c index 152bbe3ce..dac448b28 100644 --- a/src/quic_rx.c +++ b/src/quic_rx.c @@ -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; }