From 4fd53d772f6534c2556ef0348a55d25f93a6f479 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Tue, 21 Dec 2021 14:28:26 +0100 Subject: [PATCH] MINOR: quic: add const qualifier for traces function 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 | 3 ++- include/haproxy/xprt_quic.h | 3 ++- src/quic_tls.c | 3 ++- src/xprt_quic.c | 8 ++------ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/haproxy/quic_tls.h b/include/haproxy/quic_tls.h index 209576a4e1..500f125f42 100644 --- a/include/haproxy/quic_tls.h +++ b/include/haproxy/quic_tls.h @@ -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); diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index 13de0f196f..7004164f2e 100644 --- a/include/haproxy/xprt_quic.h +++ b/include/haproxy/xprt_quic.h @@ -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; diff --git a/src/quic_tls.c b/src/quic_tls.c index fcb80a34f9..8100d47590 100644 --- a/src/quic_tls.c +++ b/src/quic_tls.c @@ -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 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); diff --git a/src/xprt_quic.c b/src/xprt_quic.c index ae5241f6e2..c15f4b423f 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -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),