]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QLOG: Minor updates
authorHugo Landau <hlandau@openssl.org>
Wed, 24 Jan 2024 11:00:53 +0000 (11:00 +0000)
committerHugo Landau <hlandau@openssl.org>
Fri, 2 Feb 2024 11:50:29 +0000 (11:50 +0000)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22037)

ssl/quic/build.info
ssl/quic/qlog.c
ssl/quic/qlog_event_helpers.c

index 231e6bc4e8816e9a99d399b43318f07df6fb157e..191342ea1b19e2cf2f74c56f7bd53353f1d5421d 100644 (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
index b0cb68bdb03a1b60e70450d133686448635aac23..e084d47ac7c1aa1965cb504e1ac587c0ca9b62cf 100644 (file)
 #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;
index fd1d64af211202425d7da53a4a10a054545faf2b..6a726029904ef03f92a0002595f972f6e7ab0310 100644 (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);