]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: add const qualifier for traces function
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 21 Dec 2021 13:28:26 +0000 (14:28 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 21 Dec 2021 14:53:19 +0000 (15:53 +0100)
Add const qualifier on arguments of several dump functions used in the
trace callback. This is required to be able to replace the first trace
argument by a quic_conn instance. The first argument is a const pointer
and so the members accessed through it must also be const.

include/haproxy/quic_tls.h
include/haproxy/xprt_quic.h
src/quic_tls.c
src/xprt_quic.c

index 209576a4e14f8eb8486010f68cd48bdd13068021..500f125f427ed8c5671761683267142747c093b0 100644 (file)
@@ -42,7 +42,8 @@ unsigned char initial_salt_v1[20] = {
        0xcc, 0xbb, 0x7f, 0x0a
 };
 
-void quic_tls_keys_hexdump(struct buffer *buf, struct quic_tls_secrets *secs);
+void quic_tls_keys_hexdump(struct buffer *buf,
+                           const struct quic_tls_secrets *secs);
 
 void quic_tls_secret_hexdump(struct buffer *buf,
                              const unsigned char *secret, size_t secret_len);
index 13de0f196f8244b043c897033de333fb6ab36cee..7004164f2e082a8ccd45af86c2e1b18fdba2bfb5 100644 (file)
@@ -114,7 +114,8 @@ static inline size_t quic_cid_saddr_cat(struct quic_cid *cid,
  * debugging purposes.
  * Always succeeds.
  */
-static inline void quic_cid_dump(struct buffer *buf, struct quic_cid *cid)
+static inline void quic_cid_dump(struct buffer *buf,
+                                 const struct quic_cid *cid)
 {
        int i;
 
index fcb80a34f90cbdad56c729b618501882073e36eb..8100d475903a86d74067015e6bfba9b90754d9c9 100644 (file)
@@ -23,7 +23,8 @@ __attribute__((format (printf, 3, 4)))
 void hexdump(const void *buf, size_t buflen, const char *title_fmt, ...);
 
 /* Dump the RX/TX secrets of <secs> QUIC TLS secrets. */
-void quic_tls_keys_hexdump(struct buffer *buf, struct quic_tls_secrets *secs)
+void quic_tls_keys_hexdump(struct buffer *buf,
+                           const struct quic_tls_secrets *secs)
 {
        int i;
        size_t aead_keylen = (size_t)EVP_CIPHER_key_length(secs->aead);
index ae5241f6e202eae0ae6e2174fc0934fa0e82e4a1..c15f4b423fcf7c88978ed8ff5379b1ef13769e6f 100644 (file)
@@ -321,9 +321,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
                        const ssize_t *room = a4;
 
                        if (qel) {
-                               struct quic_pktns *pktns;
-
-                               pktns = qc->pktns;
+                               const struct quic_pktns *pktns = qc->pktns;
                                chunk_appendf(&trace_buf, " qel=%c cwnd=%llu ppif=%lld pif=%llu "
                                              "if=%llu pp=%u pdg=%d",
                                              quic_enc_level_char_from_qel(qel, qc),
@@ -422,9 +420,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
                        const struct quic_enc_level *qel = a2;
 
                        if (qel) {
-                               struct quic_pktns *pktns;
-
-                               pktns = qc->pktns;
+                               const struct quic_pktns *pktns = qc->pktns;
                                chunk_appendf(&trace_buf,
                                              " qel=%c state=%s ack?%d cwnd=%llu ppif=%lld pif=%llu if=%llu pp=%u pdg=%llu",
                                              quic_enc_level_char_from_qel(qel, qc),