From: Frédéric Lécaille Date: Tue, 28 Dec 2021 13:27:43 +0000 (+0100) Subject: MINOR: quic: Wrong ack_delay compution before calling quic_loss_srtt_update() X-Git-Tag: v2.6-dev1~179 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22576a2e55fe3ddfcb4d93f80d2c6591410ada47;p=thirdparty%2Fhaproxy.git MINOR: quic: Wrong ack_delay compution before calling quic_loss_srtt_update() RFC 9002 5.3. Estimating smoothed_rtt and rttvar: MUST use the lesser of the acknowledgment delay and the peer's max_ack_delay after the handshake is confirmed. --- diff --git a/include/haproxy/quic_loss.h b/include/haproxy/quic_loss.h index 6105ceaeb4..cc48f0df58 100644 --- a/include/haproxy/quic_loss.h +++ b/include/haproxy/quic_loss.h @@ -42,8 +42,8 @@ static inline void quic_loss_init(struct quic_loss *ql) } /* Update QUIC loss information with new measurement and - * on ACK frame receipt which MUST be min(ack->ack_delay, max_ack_delay) for - * non handshake packets. + * on ACK frame receipt which MUST be min(ack->ack_delay, max_ack_delay) + * before the handshake is confirmed. */ static inline void quic_loss_srtt_update(struct quic_loss *ql, unsigned int rtt, unsigned int ack_delay, diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 0a1ef8e0fc..f81d044a7c 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -2208,7 +2208,9 @@ static int qc_parse_pkt_frms(struct quic_rx_packet *pkt, struct ssl_sock_ctx *ct unsigned int ack_delay; ack_delay = !quic_application_pktns(qel->pktns, qc) ? 0 : - MS_TO_TICKS(QUIC_MIN(quic_ack_delay_ms(&frm.ack, qc), qc->max_ack_delay)); + HA_ATOMIC_LOAD(&qc->state) >= QUIC_HS_ST_CONFIRMED ? + MS_TO_TICKS(QUIC_MIN(quic_ack_delay_ms(&frm.ack, qc), qc->max_ack_delay)) : + MS_TO_TICKS(quic_ack_delay_ms(&frm.ack, qc)); quic_loss_srtt_update(&qc->path->loss, rtt_sample, ack_delay, qc); } break;