QLOG: Minor updates

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22037)
This commit is contained in:
Hugo Landau 2024-01-24 11:00:53 +00:00
parent ae300c0d5e
commit ba8b093be7
3 changed files with 16 additions and 14 deletions

View File

@ -20,5 +20,5 @@ SOURCE[$LIBSSL]=quic_types.c
SOURCE[$LIBSSL]=qlog_event_helpers.c
IF[{- !$disabled{qlog} -}]
SOURCE[$LIBSSL]=json_enc.c qlog.c
SHARED_SOURCE[$LIBSSL]=../../crypto/getenv.c
SHARED_SOURCE[$LIBSSL]=../../crypto/getenv.c ../../crypto/ctype.c
ENDIF

View File

@ -11,9 +11,10 @@
#include "internal/json_enc.h"
#include "internal/common.h"
#include "internal/cryptlib.h"
#include "crypto/ctype.h"
# define BITS_PER_WORD (sizeof(size_t) * 8)
# define NUM_ENABLED_W ((QLOG_EVENT_TYPE_NUM + BITS_PER_WORD - 1) / BITS_PER_WORD)
#define BITS_PER_WORD (sizeof(size_t) * 8)
#define NUM_ENABLED_W ((QLOG_EVENT_TYPE_NUM + BITS_PER_WORD - 1) / BITS_PER_WORD)
static ossl_unused ossl_inline int bit_get(const size_t *p, uint32_t bit_no)
{
@ -111,9 +112,9 @@ QLOG *ossl_qlog_new_from_env(const QLOG_TRACE_INFO *info)
qlogdir_sep = ossl_determine_dirsep(qlogdir);
/* strlen("client" / "server"); strlen(".sqlog"); _; separator; _; NUL */
strl = l + info->odcid.id_len * 2 + 6 + 7 + 2;
filename = OPENSSL_malloc(strl + 1);
/* dir; [sep]; ODCID; _; strlen("client" / "server"); strlen(".sqlog"); NUL */
strl = l + 1 + info->odcid.id_len * 2 + 1 + 6 + 6 + 1;
filename = OPENSSL_malloc(strl);
if (filename == NULL)
return NULL;
@ -303,8 +304,10 @@ static void qlog_event_seq_header(QLOG *qlog)
ossl_json_key(&qlog->json, "system_info");
ossl_json_object_begin(&qlog->json);
{
#if defined(OPENSSL_SYS_UNIX) || defined(OPENSSL_SYS_WINDOWS)
ossl_json_key(&qlog->json, "process_id");
ossl_json_u64(&qlog->json, (uint64_t)getpid());
#endif
} /* system_info */
ossl_json_object_end(&qlog->json);
} /* common_fields */
@ -315,7 +318,7 @@ static void qlog_event_seq_header(QLOG *qlog)
{
ossl_json_key(&qlog->json, "type");
ossl_json_str(&qlog->json, qlog->info.is_server
? "server" : "client");
? "server" : "client");
} /* vantage_point */
ossl_json_object_end(&qlog->json);
} /* trace */
@ -491,9 +494,7 @@ static ossl_inline int is_term_sep_ws(char c)
static ossl_inline int is_name_char(char c)
{
return (c >= 'a' && c <= 'z')
|| (c >= 'A' && c <= 'Z')
|| c == '_' || c == '-';
return ossl_isalpha(c) || ossl_isdigit(c) || c == '_' || c == '-';
}
static int lex_init(struct lexer *lex, const char *in, size_t in_len)
@ -618,7 +619,8 @@ static void filter_apply(size_t *enabled, int add,
static int lex_fail(struct lexer *lex, const char *msg)
{
/*
* TODO(QLOG): Determine how to print log messages about bad filter strings
* TODO(QLOG FUTURE): Determine how to print log messages about bad filter
* strings
*/
lex->p = lex->term_end = lex->end;
return 0;

View File

@ -134,7 +134,7 @@ void ossl_qlog_event_connectivity_connection_closed(QLOG *qlog,
(unsigned long long)tcause->error_code);
m = ce;
}
/* TODO(QLOG): Consider adding ERR information in the output. */
/* TODO(QLOG FUTURE): Consider adding ERR information in the output. */
if (m != NULL)
QLOG_STR("connection_code", m);
@ -497,7 +497,7 @@ unknown:
/*
* Can't continue scanning for frames in this case as the frame length
* is unknown. We log the entire body the rest of the packet payload
* is unknown. We log the entire body of the rest of the packet payload
* as the raw data of the frame.
*/
QLOG_BEGIN("raw");
@ -591,7 +591,7 @@ static void log_packet(QLOG *qlog_instance,
QLOG_END()
QLOG_END()
}
/* TODO(QLOG): flags, length */
/* TODO(QLOG FUTURE): flags, length */
QLOG_END()
QLOG_U64("datagram_id", datagram_id);