From 8e6f749f18941f2a20b9b1c1a7fd9975231134d0 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 16 Jun 2021 17:47:24 +0200 Subject: [PATCH] MINOR: mux-h2/trace: report a few connection-level info during h2_init() It is currently very difficult to match some H2 trace outputs against some log extracts because there's no exactly equivalent info. This patch tries to address this by adding a TRACE_USER() call in h2_init() that is matched in h2_trace() to report: - connection pointer and direction - frontend's name or server's name - transport layer and control layer (e.g. "SSL/tcpv4") - source and/or destination depending on what is set This now permits to get something like this at verbosity level complete: <0>2021-06-16T18:30:19.810897+02:00 [00|h2|1|mux_h2.c:1006] new H2 connection : h2c=0x19fee50(F,PRF) : conn=0x7f373c026850(IN) fe=h2gw RAW/tcpv4 src=127.0.0.1:19540 <0>2021-06-16T18:30:19.810919+02:00 [00|h2|1|mux_h2.c:2731] rcvd H2 request : h2c=0x19fee50(F,FRH) <0>2021-06-16T18:30:19.810998+02:00 [00|h2|1|mux_h2.c:1006] new H2 connection : h2c=0x1a04ee0(B,PRF) : conn=0x1a04ce0(OUT) sv=h2gw/s1 RAW/tcpv4 dst=127.0.0.1:4446 --- src/mux_h2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mux_h2.c b/src/mux_h2.c index 1374cd7..79e5b3b 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -618,6 +618,9 @@ static void h2_trace(enum trace_level level, uint64_t mask, const struct trace_s if (src->verbosity > H2_VERB_CLEAN) { chunk_appendf(&trace_buf, " : h2c=%p(%c,%s)", h2c, conn_is_back(conn) ? 'B' : 'F', h2c_st_to_str(h2c->st0)); + if (mask & H2_EV_H2C_NEW) // inside h2_init, otherwise it's hard to match conn & h2c + conn_append_debug_info(&trace_buf, conn, " : "); + if (h2c->errcode) chunk_appendf(&trace_buf, " err=%s/%02x", h2_err_str(h2c->errcode), h2c->errcode); @@ -1000,6 +1003,8 @@ static int h2_init(struct connection *conn, struct proxy *prx, struct session *s conn->ctx = h2c; + TRACE_USER("new H2 connection", H2_EV_H2C_NEW, conn); + if (t) task_queue(t); -- 1.7.10.4