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.
This commit is contained in:
Frédéric Lécaille 2021-12-17 16:11:54 +01:00
parent 0ece75c66a
commit 91ac6c3a8a
2 changed files with 27 additions and 0 deletions

View 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,

View 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;
}
}