]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add connection flags to traces
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 12 Apr 2023 11:41:54 +0000 (13:41 +0200)
committerFrédéric Lécaille <flecaille@haproxy.com>
Thu, 13 Apr 2023 17:20:08 +0000 (19:20 +0200)
This should help in diagnosing issues.

Some adjustments have to be done to avoid deferencing a quic_conn objects from
TRACE_*() calls.

Must be backported to 2.7 and 2.6.

src/quic_conn.c
src/xprt_quic.c

index 9412b8900f16e59a02303d4921d6bcbaf17865d5..1670da40f47193f8aa999e47278c6435d34e2823 100644 (file)
@@ -280,7 +280,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
        if (qc) {
                const struct quic_tls_ctx *tls_ctx;
 
-               chunk_appendf(&trace_buf, " : qc@%p", qc);
+               chunk_appendf(&trace_buf, " : qc@%p flags=0x%x", qc, qc->flags);
                if (mask & QUIC_EV_CONN_INIT) {
                        chunk_appendf(&trace_buf, "\n  odcid");
                        quic_cid_dump(&trace_buf, &qc->odcid);
@@ -5673,6 +5673,7 @@ void quic_conn_release(struct quic_conn *qc)
 
        pool_free(pool_head_quic_conn_rxbuf, qc->rx.buf.area);
        pool_free(pool_head_quic_conn, qc);
+       qc = NULL;
 
        TRACE_PROTO("QUIC conn. freed", QUIC_EV_CONN_FREED, qc);
 
index 2a4d01e07798028d3f2e91f7d6e5350497a16baf..cfb93e7de2b31cdc64f4cb1740314c2d0f562e66 100644 (file)
@@ -31,6 +31,7 @@ static void quic_close(struct connection *conn, void *xprt_ctx)
        /* If the quic-conn timer has already expired free the quic-conn. */
        if (qc->flags & QUIC_FL_CONN_EXP_TIMER) {
                quic_conn_release(qc);
+               qc = NULL;
                goto leave;
        }
 
@@ -108,7 +109,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx)
 {
        struct quic_conn *qc = NULL;
 
-       TRACE_ENTER(QUIC_EV_CONN_NEW, conn);
+       TRACE_ENTER(QUIC_EV_CONN_NEW, qc);
 
        /* do not store the context if already set */
        if (*xprt_ctx)