From 687326ce0ac56c405029cfedd435b2e6625a22e3 Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Tue, 24 Oct 2023 08:23:39 +0100 Subject: QUIC MULTISTREAM TEST: Output connection closure reason info on failure Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/22485) --- test/quic_multistream_test.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c index 09792c2f71..25cd83db34 100644 --- a/test/quic_multistream_test.c +++ b/test/quic_multistream_test.c @@ -1945,6 +1945,8 @@ out: s_unlock(h, hl); /* idempotent */ if (!testresult) { size_t i; + const QUIC_TERMINATE_CAUSE *tcause; + const char *e_str, *f_str; TEST_error("failed in script \"%s\" at op %zu, thread %d\n", script_name, op_idx + 1, thread_idx); @@ -1954,6 +1956,56 @@ out: repeat_stack_done[i], repeat_stack_limit[i], repeat_stack_idx[i]); + + ERR_print_errors_fp(stderr); + + if (h->c_conn != NULL) { + SSL_CONN_CLOSE_INFO cc_info = {0}; + + if (SSL_get_conn_close_info(h->c_conn, &cc_info, sizeof(cc_info))) { + e_str = ossl_quic_err_to_string(cc_info.error_code); + f_str = ossl_quic_frame_type_to_string(cc_info.frame_type); + + if (e_str == NULL) + e_str = "?"; + if (f_str == NULL) + f_str = "?"; + + TEST_info("client side is closed: %llu(%s)/%llu(%s), " + "%s, %s, reason: \"%s\"", + (unsigned long long)cc_info.error_code, + e_str, + (unsigned long long)cc_info.frame_type, + f_str, + (cc_info.flags & SSL_CONN_CLOSE_FLAG_LOCAL) != 0 + ? "local" : "remote", + (cc_info.flags & SSL_CONN_CLOSE_FLAG_TRANSPORT) != 0 + ? "transport" : "app", + cc_info.reason != NULL ? cc_info.reason : "-"); + } + } + + tcause = (h->s != NULL + ? ossl_quic_tserver_get_terminate_cause(h->s) : NULL); + if (tcause != NULL) { + e_str = ossl_quic_err_to_string(tcause->error_code); + f_str = ossl_quic_frame_type_to_string(tcause->frame_type); + + if (e_str == NULL) + e_str = "?"; + if (f_str == NULL) + f_str = "?"; + + TEST_info("server side is closed: %llu(%s)/%llu(%s), " + "%s, %s, reason: \"%s\"", + (unsigned long long)tcause->error_code, + e_str, + (unsigned long long)tcause->frame_type, + f_str, + tcause->remote ? "remote" : "local", + tcause->app ? "app" : "transport", + tcause->reason != NULL ? tcause->reason : "-"); + } } OPENSSL_free(tmp_buf); -- cgit v1.2.3