]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add a function to dump SSL stack errors
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 28 Sep 2021 07:04:12 +0000 (09:04 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 7 Oct 2021 15:35:25 +0000 (17:35 +0200)
This has been very helpful to fix SSL related issues.

src/xprt_quic.c

index d7cef7631c593856f5240c0bcc4e513c96b7e826..750e4d016cd6d206b706f6bac0218a61662e0eb8 100644 (file)
@@ -1562,6 +1562,26 @@ static inline int qc_parse_ack_frm(struct quic_frame *frm, struct ssl_sock_ctx *
        return 0;
 }
 
+/* This function gives the detail of the SSL error. It is used only
+ * if the debug mode and the verbose mode are activated. It dump all
+ * the SSL error until the stack was empty.
+ */
+static forceinline void qc_ssl_dump_errors(struct connection *conn)
+{
+       if (unlikely(global.mode & MODE_DEBUG)) {
+               while (1) {
+                       unsigned long ret;
+
+                       ret = ERR_get_error();
+                       if (!ret)
+                               return;
+
+                       fprintf(stderr, "conn. @%p OpenSSL error[0x%lx] %s: %s\n", conn, ret,
+                               ERR_func_error_string(ret), ERR_reason_error_string(ret));
+               }
+       }
+}
+
 /* Provide CRYPTO data to the TLS stack found at <data> with <len> as length
  * from <qel> encryption level with <ctx> as QUIC connection context.
  * Remaining parameter are there for debugging purposes.