]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: Wrong PTO calculation
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 8 Jun 2022 08:09:39 +0000 (10:09 +0200)
committerFrédéric Lécaille <flecaille@haproxy.com>
Thu, 16 Jun 2022 12:56:24 +0000 (14:56 +0200)
Due to missing brackets around the ternary C operator, quic_pto() could return zero
at the first run, before the QUIC connection was completely initialized. This leaded
the idle timeout task to be executed before this initialization completion. Then
this connection could be immediately released.

This bug was revealed by the multi_packet_client_hello QUIC tracker test.

Must be backported to 2.6.

include/haproxy/quic_loss.h

index 1f63e30d42a9ce6ec22fba2e9397f242f305c193..180bb359ec6b7efe37981061c7c465fbe1882186 100644 (file)
@@ -68,7 +68,7 @@ static inline unsigned int quic_pto(struct quic_conn *qc)
        struct quic_loss *ql = &qc->path->loss;
 
        return (ql->srtt >> 3) + QUIC_MAX(ql->rtt_var, QUIC_TIMER_GRANULARITY) +
-               HA_ATOMIC_LOAD(&qc->state) >= QUIC_HS_ST_COMPLETE ? qc->max_ack_delay : 0;
+               (HA_ATOMIC_LOAD(&qc->state) >= QUIC_HS_ST_COMPLETE ? qc->max_ack_delay : 0);
 }
 
 void quic_loss_srtt_update(struct quic_loss *ql,