]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-quic: report glitches to session
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 18 Sep 2024 13:33:30 +0000 (15:33 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 18 Sep 2024 14:11:03 +0000 (16:11 +0200)
Glitch counter was implemented for QUIC/HTTP3. The counter is stored in
the QCC MUX connection instance. However, this is never reported at the
session level which is necessary if glitch counter is tracked via a
stick-table.

To fix this, use session_add_glitch_ctr() in various QUIC MUX functions
which may increment glitch counter.

This should be backported up to 3.0.

src/mux_quic.c

index 78baccb8256f14573e8c6c9142eb4605d07a1e8a..513ca5aa13df0df3ce50afd25267550fdd0276b5 100644 (file)
@@ -22,6 +22,7 @@
 #include <haproxy/quic_sock.h>
 #include <haproxy/quic_stream.h>
 #include <haproxy/quic_tp-t.h>
+#include <haproxy/session.h>
 #include <haproxy/ssl_sock-t.h>
 #include <haproxy/stconn.h>
 #include <haproxy/time.h>
@@ -974,6 +975,7 @@ static int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs)
        struct buffer b;
        ssize_t ret;
        int fin = 0;
+       int prev_glitches = qcc->glitches;
 
        TRACE_ENTER(QMUX_EV_QCS_RECV, qcc->conn, qcs);
 
@@ -985,6 +987,10 @@ static int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs)
 
        if (!(qcs->flags & QC_SF_READ_ABORTED)) {
                ret = qcc->app_ops->rcv_buf(qcs, &b, fin);
+
+               if (qcc->glitches != prev_glitches)
+                       session_add_glitch_ctr(qcc->conn->owner, qcc->glitches - prev_glitches);
+
                if (ret < 0) {
                        TRACE_ERROR("decoding error", QMUX_EV_QCS_RECV, qcc->conn, qcs);
                        goto err;
@@ -1566,6 +1572,7 @@ int qcc_recv_max_stream_data(struct qcc *qcc, uint64_t id, uint64_t max)
 int qcc_recv_reset_stream(struct qcc *qcc, uint64_t id, uint64_t err, uint64_t final_size)
 {
        struct qcs *qcs;
+       int prev_glitches = qcc->glitches;
 
        TRACE_ENTER(QMUX_EV_QCC_RECV, qcc->conn);
 
@@ -1624,6 +1631,9 @@ int qcc_recv_reset_stream(struct qcc *qcc, uint64_t id, uint64_t err, uint64_t f
        qcs_free_ncbuf(qcs, &qcs->rx.ncbuf);
 
  out:
+       if (qcc->glitches != prev_glitches)
+               session_add_glitch_ctr(qcc->conn->owner, qcc->glitches - prev_glitches);
+
        TRACE_LEAVE(QMUX_EV_QCC_RECV, qcc->conn);
        return 0;
 
@@ -1641,6 +1651,7 @@ int qcc_recv_reset_stream(struct qcc *qcc, uint64_t id, uint64_t err, uint64_t f
 int qcc_recv_stop_sending(struct qcc *qcc, uint64_t id, uint64_t err)
 {
        struct qcs *qcs;
+       int prev_glitches = qcc->glitches;
 
        TRACE_ENTER(QMUX_EV_QCC_RECV, qcc->conn);
 
@@ -1726,6 +1737,9 @@ int qcc_recv_stop_sending(struct qcc *qcc, uint64_t id, uint64_t err)
                qcc_refresh_timeout(qcc);
 
  out:
+       if (qcc->glitches != prev_glitches)
+               session_add_glitch_ctr(qcc->conn->owner, qcc->glitches - prev_glitches);
+
        TRACE_LEAVE(QMUX_EV_QCC_RECV, qcc->conn);
        return 0;