Skip to content

Commit

Permalink
QUIC MULTISTREAM TEST: Output connection closure reason info on failure
Browse files Browse the repository at this point in the history
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #22485)
  • Loading branch information
hlandau authored and mattcaswell committed Oct 25, 2023
1 parent 55abe74 commit 687326c
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions test/quic_multistream_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1945,6 +1945,8 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
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);
Expand All @@ -1954,6 +1956,56 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
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);
Expand Down

0 comments on commit 687326c

Please sign in to comment.