From: Frédéric Lécaille Date: Fri, 17 Dec 2021 15:11:54 +0000 (+0100) Subject: MINOR: quic: Add a function to list remaining RX packets by encryption level X-Git-Tag: v2.6-dev1~253 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91ac6c3a8ac910d7c375ca964933a29c2fb0d90d;p=thirdparty%2Fhaproxy.git MINOR: quic: Add a function to list remaining RX packets by encryption level This is only to debug some issues which cause the RX buffer saturation with "Too big packet" traces. --- diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index fda8580a4a..b731da27a5 100644 --- a/include/haproxy/xprt_quic.h +++ b/include/haproxy/xprt_quic.h @@ -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, diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 9c6ca9c122..9d5f6ebafc 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -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; } }