SSL_GET_CONN_CLOSE_INFO(3ossl)
π SSL_GET_CONN_CLOSE_INFO π (that's the manual name, bestie, section 3ossl)
okay so. your QUIC connection just β¨endedβ¨ and you're sitting there likeβ¦ why. what happened. who did this. bestie, this page is FOR YOU. it's the whole "get information about why a QUIC connection was closed" situation and honestly? iconic. π₯
πΈ NAME πΈ
SSL_get_conn_close_info, SSL_CONN_CLOSE_FLAG_LOCAL, SSL_CONN_CLOSE_FLAG_TRANSPORT, OSSL_QUIC_ERR_NO_ERROR, OSSL_QUIC_ERR_INTERNAL_ERROR, OSSL_QUIC_ERR_CONNECTION_REFUSED, OSSL_QUIC_ERR_FLOW_CONTROL_ERROR, OSSL_QUIC_ERR_STREAM_LIMIT_ERROR, OSSL_QUIC_ERR_STREAM_STATE_ERROR, OSSL_QUIC_ERR_FINAL_SIZE_ERROR, OSSL_QUIC_ERR_FRAME_ENCODING_ERROR, OSSL_QUIC_ERR_TRANSPORT_PARAMETER_ERROR, OSSL_QUIC_ERR_CONNECTION_ID_LIMIT_ERROR, OSSL_QUIC_ERR_PROTOCOL_VIOLATION, OSSL_QUIC_ERR_INVALID_TOKEN, OSSL_QUIC_ERR_APPLICATION_ERROR, OSSL_QUIC_ERR_CRYPTO_BUFFER_EXCEEDED, OSSL_QUIC_ERR_KEY_UPDATE_ERROR, OSSL_QUIC_ERR_AEAD_LIMIT_REACHED, OSSL_QUIC_ERR_NO_VIABLE_PATH, OSSL_QUIC_ERR_CRYPTO_ERR_BEGIN, OSSL_QUIC_ERR_CRYPTO_ERR_END, OSSL_QUIC_ERR_CRYPTO_ERR, OSSL_QUIC_LOCAL_ERR_IDLE_TIMEOUT β get information about why a QUIC connection was closed π
like. the whole point. the gossip. the receipts. π§
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
#define SSL_CONN_CLOSE_FLAG_LOCAL
#define SSL_CONN_CLOSE_FLAG_TRANSPORT
typedef struct ssl_conn_close_info_st {
uint64_t error_code, frame_type;
char *reason;
size_t reason_len;
uint32_t flags;
} SSL_CONN_CLOSE_INFO;
int SSL_get_conn_close_info(SSL *ssl, SSL_CONN_CLOSE_INFO *info,
size_t info_len);
#define OSSL_QUIC_ERR_NO_ERROR 0x00
#define OSSL_QUIC_ERR_INTERNAL_ERROR 0x01
#define OSSL_QUIC_ERR_CONNECTION_REFUSED 0x02
#define OSSL_QUIC_ERR_FLOW_CONTROL_ERROR 0x03
#define OSSL_QUIC_ERR_STREAM_LIMIT_ERROR 0x04
#define OSSL_QUIC_ERR_STREAM_STATE_ERROR 0x05
#define OSSL_QUIC_ERR_FINAL_SIZE_ERROR 0x06
#define OSSL_QUIC_ERR_FRAME_ENCODING_ERROR 0x07
#define OSSL_QUIC_ERR_TRANSPORT_PARAMETER_ERROR 0x08
#define OSSL_QUIC_ERR_CONNECTION_ID_LIMIT_ERROR 0x09
#define OSSL_QUIC_ERR_PROTOCOL_VIOLATION 0x0A
#define OSSL_QUIC_ERR_INVALID_TOKEN 0x0B
#define OSSL_QUIC_ERR_APPLICATION_ERROR 0x0C
#define OSSL_QUIC_ERR_CRYPTO_BUFFER_EXCEEDED 0x0D
#define OSSL_QUIC_ERR_KEY_UPDATE_ERROR 0x0E
#define OSSL_QUIC_ERR_AEAD_LIMIT_REACHED 0x0F
#define OSSL_QUIC_ERR_NO_VIABLE_PATH 0x10
/* Inclusive range for handshake-specific errors. */
#define OSSL_QUIC_ERR_CRYPTO_ERR_BEGIN 0x0100
#define OSSL_QUIC_ERR_CRYPTO_ERR_END 0x01FF
#define OSSL_QUIC_ERR_CRYPTO_ERR(X)
#define OSSL_QUIC_LOCAL_ERR_IDLE_TIMEOUT
copy it exactly, bestie, don't freestyle. π
π¦ DESCRIPTION π¦
so SSL_get_conn_close_info() is the function that spills the tea β about why and how a QUIC connection was closed. it's giving detective energy, fr fr.
the closure info gets written into *info, and *info MUST be non-NULL. like, mandatory mandatory. and info_len has to be set to sizeof(*info). no cap.
here's the fields it sets, one by one, because we're thorough like that π
π the fields
error_codeβ this is a 62-bit QUIC error code. it's either a 62-bit application error code (ifSSL_CONN_CLOSE_FLAG_TRANSPORTis not set inflags) or a 62-bit standard QUIC transport error code (ifSSL_CONN_CLOSE_FLAG_TRANSPORTis set inflags). two moods, one field.frame_typeβ ifSSL_CONN_CLOSE_FLAG_TRANSPORTis set, this may be set to a QUIC frame type number that caused the connection to be closed. it may also be set to0if no frame type was specified as causing the closure. ifSSL_CONN_CLOSE_FLAG_TRANSPORTis not set, this is set to0. simple as that.reasonβ if non-NULL, this is intended to be a UTF-8 textual string briefly describing the reason for connection closure. the length of the reason string in bytes is given inreason_len. and listen: while, if non-NULL, OpenSSL guarantees this string will be zero terminated, please consider that this buffer may originate from the (untrusted) peer and thus may also contain zero bytes elsewhere. so usereason_len, bestie, seriously. π
also β while it is intended, as per the QUIC protocol, that this be a UTF-8 string, there is no guarantee that this is the case for strings received from the peer. the peer is not your friend here, okay? trust issues are valid. π
SSL_CONN_CLOSE_FLAG_LOCALβ ifflagshasSSL_CONN_CLOSE_FLAG_LOCALset, the connection closure was locally triggered. this could be because of an application request (e.g. ifSSL_CONN_CLOSE_FLAG_TRANSPORTis unset), or (ifSSL_CONN_CLOSE_FLAG_TRANSPORTis set) due to logic internal to the QUIC implementation β for example, if the peer engages in a protocol violation, or an idle timeout occurs. messy of them, honestly.
if unset, the connection closure was remotely triggered. so it was them, not you. π
SSL_CONN_CLOSE_FLAG_TRANSPORTβ ifflagshasSSL_CONN_CLOSE_FLAG_TRANSPORTset, the connection closure was triggered for QUIC protocol reasons. otherwise, the connection closure was triggered by the local or remote application.
π the error code macros
the OSSL_QUIC_ERR macro definitions provide the QUIC transport error codes as defined by RFC 9000. π
the OSSL_QUIC_ERR_CRYPTO_ERR() macro can be used to convert a TLS alert code into a QUIC transport error code by mapping it into the range reserved for such codes by RFC 9000. that range begins at OSSL_QUIC_ERR_CRYPTO_ERR_BEGIN and ends at OSSL_QUIC_ERR_CRYPTO_ERR_END, inclusive. glow-up for your error codes, lowkey. β¨
π NON-STANDARD TRANSPORT ERROR CODES π
some conditions that can cause QUIC connection termination are not signalled on the wire and therefore do not have standard error codes. OpenSSL indicates these errors via SSL_get_conn_close_info() by setting SSL_CONN_CLOSE_FLAG_TRANSPORT and using one of the following error values. these codes are specific to OpenSSL, and cannot be sent over the wire, as they are above 2**62. so they're homegrown. exclusive. iykyk. π«Ά
OSSL_QUIC_LOCAL_ERR_IDLE_TIMEOUTβ the connection was terminated immediately due to the idle timeout expiring. yeah. it justβ¦ left. no text back. π
π« RETURN VALUES π«
SSL_get_conn_close_info() returns 1 on success and 0 on failure. slay when it's 1.
and it fails if you call it on a QUIC connection SSL object which has not yet been terminated β like, bestie, nothing has happened yet, there's nothing to report. it also fails if you call it on a QUIC stream SSL object or a non-QUIC SSL object. wrong audience. π
π SEE ALSO π
SSL_shutdown_ex(3) β go read that one next, it's in the same friend group. π¦
β HISTORY β
this function was added in OpenSSL 3.2. so it's a newer baddie. β¨
π COPYRIGHT π
Copyright 2002-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
okay that's the whole page, no notes, ate and left no crumbs π
version 3.5.9, dated 2026-09-29, and yes this is SSL_GET_CONN_CLOSE_INFO(3ossl) signing off β mwah, go close some connections responsibly ππβ¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms