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.
This commit is contained in:
Frdric Lcaille 2023-08-29 11:01:19 +02:00 committed by Willy Tarreau
parent b50a471adb
commit 3c90c1ce6b

View File

@ -592,7 +592,7 @@ static int qc_parse_ack_frm(struct quic_conn *qc,
unsigned int time_sent, pkt_flags; unsigned int time_sent, pkt_flags;
struct list newly_acked_pkts = LIST_HEAD_INIT(newly_acked_pkts); struct list newly_acked_pkts = LIST_HEAD_INIT(newly_acked_pkts);
struct list lost_pkts = LIST_HEAD_INIT(lost_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); TRACE_ENTER(QUIC_EV_CONN_PRSAFRM, qc);
@ -624,6 +624,7 @@ static int qc_parse_ack_frm(struct quic_conn *qc,
else { else {
time_sent = eb64_entry(largest_node, time_sent = eb64_entry(largest_node,
struct quic_tx_packet, pn_node)->time_sent; 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); qc, NULL, &largest, &smallest);
} while (1); } 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); *rtt_sample = tick_remain(time_sent, now_ms);
qel->pktns->rx.largest_acked_pn = ack_frm->largest_ack; qel->pktns->rx.largest_acked_pn = ack_frm->largest_ack;
} }