]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: activate QUIC traces at compilation
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 25 Nov 2021 15:05:16 +0000 (16:05 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 25 Nov 2021 15:12:44 +0000 (16:12 +0100)
Implement a function quic_init_stdout_traces called at STG_INIT. If
ENABLE_QUIC_STDOUT_TRACES preprocessor define is set, the QUIC trace
module will be automatically activated to emit traces on stdout on the
developer level.

The main purpose for now is to be able to generate traces on the haproxy
docker image used for QUIC interop testing suite. This should facilitate
test failure analysis.

src/xprt_quic.c

index c2d753ddc368d8310478c6657efc7d7c90679c2e..6253ddafe6cee8d694e803359ea0d4eb229f2d2e 100644 (file)
@@ -46,6 +46,7 @@
 #include <haproxy/quic_loss.h>
 #include <haproxy/cbuf.h>
 #include <haproxy/quic_tls.h>
+#include <haproxy/sink.h>
 #include <haproxy/ssl_sock.h>
 #include <haproxy/stream_interface.h>
 #include <haproxy/task.h>
@@ -5011,6 +5012,21 @@ ssize_t quic_lstnr_dgram_read(struct buffer *buf, size_t len, void *owner,
        return quic_dgram_read(buf, len, owner, saddr, qc_lstnr_pkt_rcv);
 }
 
+/* Function to automatically activate QUIC traces on stdout.
+ * Activated via the compilation flag -DENABLE_QUIC_STDOUT_TRACES.
+ * Main use for now is in the docker image for QUIC interop testing.
+ */
+static void quic_init_stdout_traces(void)
+{
+#ifdef ENABLE_QUIC_STDOUT_TRACES
+       trace_quic.sink = sink_find("stdout");
+       trace_quic.level = TRACE_LEVEL_DEVELOPER;
+       trace_quic.verbosity = 0;
+       trace_quic.state = TRACE_STATE_RUNNING;
+#endif
+}
+INITCALL0(STG_INIT, quic_init_stdout_traces);
+
 /*
  * Local variables:
  *  c-indent-level: 8