From: Frédéric Lécaille Date: Thu, 16 Dec 2021 10:21:52 +0000 (+0100) Subject: MINOR: quic: Do not mix packet number space and connection flags X-Git-Tag: v2.6-dev1~267 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25eeebe2933cfe2b416a4052410375f9e218a230;p=thirdparty%2Fhaproxy.git MINOR: quic: Do not mix packet number space and connection flags The packet number space flags were mixed with the connection level flags. This leaded to ACK to be sent at the connection level without regard to the underlying packet number space. But we want to be able to acknowleged packets for a specific packet number space. --- diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h index e3ded3931a..6c236fce88 100644 --- a/include/haproxy/xprt_quic-t.h +++ b/include/haproxy/xprt_quic-t.h @@ -617,8 +617,9 @@ struct rxbuf { #define QUIC_FL_PKTNS_ACK_REQUIRED_BIT 0 #define QUIC_FL_PKTNS_ACK_REQUIRED (1UL << QUIC_FL_PKTNS_ACK_REQUIRED_BIT) -#define QUIC_FL_CONN_ANTI_AMPLIFICATION_REACHED (1U << 1) -#define QUIC_FL_CONN_ODCID_NODE_TO_DELETE_BIT 2 +/* Flags at connection level */ +#define QUIC_FL_CONN_ANTI_AMPLIFICATION_REACHED (1U << 0) +#define QUIC_FL_CONN_ODCID_NODE_TO_DELETE_BIT 1 #define QUIC_FL_CONN_ODCID_NODE_TO_DELETE (1U << QUIC_FL_CONN_ODCID_NODE_TO_DELETE_BIT) #define QUIC_FL_CONN_IMMEDIATE_CLOSE (1U << 31) struct quic_conn { diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 760b9a76df..7a3a02cd47 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -429,7 +429,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace " qel=%c state=%s ack?%d cwnd=%llu ppif=%lld pif=%llu if=%llu pp=%u pdg=%llu", quic_enc_level_char_from_qel(qel, qc), quic_hdshk_state_str(HA_ATOMIC_LOAD(&qc->state)), - !!(HA_ATOMIC_LOAD(&qc->flags) & QUIC_FL_PKTNS_ACK_REQUIRED), + !!(HA_ATOMIC_LOAD(&qel->pktns->flags) & QUIC_FL_PKTNS_ACK_REQUIRED), (unsigned long long)qc->path->cwnd, (unsigned long long)qc->path->prep_in_flight, (unsigned long long)qc->path->in_flight, @@ -2446,7 +2446,7 @@ static int qc_prep_pkts(struct qring *qr, struct ssl_sock_ctx *ctx) nb_ptos = HA_ATOMIC_LOAD(&qc->tx.nb_pto_dgrams); } while (nb_ptos && !HA_ATOMIC_CAS(&qc->tx.nb_pto_dgrams, &nb_ptos, nb_ptos - 1)); } - ack = HA_ATOMIC_BTR(&qc->flags, QUIC_FL_PKTNS_ACK_REQUIRED_BIT); + ack = HA_ATOMIC_BTR(&qel->pktns->flags, QUIC_FL_PKTNS_ACK_REQUIRED_BIT); } /* Do not build any more packet if the TX secrets are not available or * if there is nothing to send, i.e. if no CONNECTION_CLOSE or ACK are required @@ -2488,7 +2488,7 @@ static int qc_prep_pkts(struct qring *qr, struct ssl_sock_ctx *ctx) if (!prv_pkt && nb_ptos) HA_ATOMIC_ADD(&qc->tx.nb_pto_dgrams, 1); if (ack) - HA_ATOMIC_BTS(&qc->flags, QUIC_FL_PKTNS_ACK_REQUIRED_BIT); + HA_ATOMIC_BTS(&qel->pktns->flags, QUIC_FL_PKTNS_ACK_REQUIRED_BIT); } switch (err) { case -2: @@ -3035,7 +3035,7 @@ int qc_treat_rx_pkts(struct quic_enc_level *cur_el, struct quic_enc_level *next_ if (pkt->flags & QUIC_FL_RX_PACKET_ACK_ELICITING && (!(HA_ATOMIC_ADD_FETCH(&qc->rx.nb_ack_eliciting, 1) & 1) || force_ack)) - HA_ATOMIC_BTS(&qc->flags, QUIC_FL_PKTNS_ACK_REQUIRED_BIT); + HA_ATOMIC_BTS(&qel->pktns->flags, QUIC_FL_PKTNS_ACK_REQUIRED_BIT); if (pkt->pn > largest_pn) largest_pn = pkt->pn; /* Update the list of ranges to acknowledge. */