]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Do not mix packet number space and connection flags
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 16 Dec 2021 10:21:52 +0000 (11:21 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 17 Dec 2021 07:38:43 +0000 (08:38 +0100)
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.

include/haproxy/xprt_quic-t.h
src/xprt_quic.c

index e3ded3931a57f1f67dbaad240ee4e74d04d70ac2..6c236fce88bd4b6e218301011dd6581ab3581f0e 100644 (file)
@@ -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 {
index 760b9a76df4ba1a1a6bc666493c876e8a5f0bb81..7a3a02cd4721a1be5a9dde101cb09dfb4451c2bc 100644 (file)
@@ -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. */