]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add a function to list remaining RX packets by encryption level
authorFrédéric Lécaille <flecaille@haproxy.com>
Fri, 17 Dec 2021 15:11:54 +0000 (16:11 +0100)
committerFrédéric Lécaille <flecaille@haproxy.com>
Mon, 20 Dec 2021 16:33:51 +0000 (17:33 +0100)
This is only to debug some issues which cause the RX buffer saturation
with "Too big packet" traces.

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

index fda8580a4a493520c8c89dbd11f207a2ccbf8672..b731da27a52169087ca7dafdf40b7345b024ed96 100644 (file)
@@ -1138,6 +1138,32 @@ static inline void qc_el_rx_pkts_del(struct quic_enc_level *qel)
        HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
 }
 
+static inline void qc_list_qel_rx_pkts(struct quic_enc_level *qel)
+{
+       struct eb64_node *node;
+
+       HA_RWLOCK_RDLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
+       node = eb64_first(&qel->rx.pkts);
+       while (node) {
+               struct quic_rx_packet *pkt;
+
+               pkt = eb64_entry(&node->node, struct quic_rx_packet, pn_node);
+               fprintf(stderr, "pkt@%p type=%d pn=%llu\n",
+                       pkt, pkt->type, (ull)pkt->pn_node.key);
+               node = eb64_next(node);
+       }
+       HA_RWLOCK_RDUNLOCK(QUIC_LOCK, &qel->rx.pkts_rwlock);
+}
+
+static inline void qc_list_all_rx_pkts(struct quic_conn *qc)
+{
+       fprintf(stderr, "REMAINING QEL RX PKTS:\n");
+       qc_list_qel_rx_pkts(&qc->els[QUIC_TLS_ENC_LEVEL_INITIAL]);
+       qc_list_qel_rx_pkts(&qc->els[QUIC_TLS_ENC_LEVEL_EARLY_DATA]);
+       qc_list_qel_rx_pkts(&qc->els[QUIC_TLS_ENC_LEVEL_HANDSHAKE]);
+       qc_list_qel_rx_pkts(&qc->els[QUIC_TLS_ENC_LEVEL_APP]);
+}
+
 void quic_set_tls_alert(struct quic_conn *qc, int alert);
 int quic_set_app_ops(struct quic_conn *qc, const unsigned char *alpn, size_t alpn_len);
 ssize_t quic_lstnr_dgram_read(struct buffer *buf, size_t len, void *owner,
index 9c6ca9c122e111d9507648d2e695f843e3000ff6..9d5f6ebafcf2a0a368faba2f7626d2f54cdd1d03 100644 (file)
@@ -4173,6 +4173,7 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char **buf, const unsigned char *end,
                if (b_contig_space(&qc->rx.buf) < pkt->len) {
                        HA_RWLOCK_WRUNLOCK(QUIC_LOCK, &qc->rx.buf_rwlock);
                        TRACE_PROTO("Too big packet", QUIC_EV_CONN_LPKT, qc->conn, pkt, &pkt->len);
+                       qc_list_all_rx_pkts(qc);
                        goto err;
                }
        }