From e0aa41ad01ebdd2dd4ba3872027cad83577ca821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= Date: Fri, 8 Aug 2025 17:31:34 +0200 Subject: [PATCH 1/3] third_party: fix libquic build on older systems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG: https://bugzilla.samba.org/show_bug.cgi?id=15896 Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Björn Baumbach Signed-off-by: Stefan Metzmacher Reviewed-by: Stefan Metzmacher (cherry picked from commit 149933854f39b4628b14abc5dcd57e73e2a0a637) --- third_party/quic/libquic_handshake_wrapper.c | 2 ++ third_party/quic/wscript | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 third_party/quic/libquic_handshake_wrapper.c diff --git a/third_party/quic/libquic_handshake_wrapper.c b/third_party/quic/libquic_handshake_wrapper.c new file mode 100644 index 00000000000..3590eee5e11 --- /dev/null +++ b/third_party/quic/libquic_handshake_wrapper.c @@ -0,0 +1,2 @@ +#include "replace.h" +#include "libquic/handshake.c" diff --git a/third_party/quic/wscript b/third_party/quic/wscript index 3715e35e022..ab5cceab70b 100644 --- a/third_party/quic/wscript +++ b/third_party/quic/wscript @@ -19,6 +19,12 @@ def configure(conf): conf.SET_TARGET_TYPE('quic', 'EMPTY') return + if not conf.CHECK_DECLS('TLS_CIPHER_AES_GCM_256', headers='linux/tls.h'): + conf.DEFINE('TLS_CIPHER_AES_GCM_256', 52) + + if not conf.CHECK_DECLS('TLS_CIPHER_AES_CCM_128', headers='linux/tls.h'): + conf.DEFINE('TLS_CIPHER_AES_CCM_128', 53) + if not conf.CHECK_DECLS('TLS_CIPHER_CHACHA20_POLY1305', headers='linux/tls.h'): conf.DEFINE('TLS_CIPHER_CHACHA20_POLY1305', 54) @@ -46,7 +52,7 @@ def build(bld): bld.SAMBA_LIBRARY('quic', source=''' - libquic/handshake.c + libquic_handshake_wrapper.c ''', includes='libquic modules/include/uapi', deps='replace', -- 2.43.0 From b9fcf1f7d80a5c6eb3ec4e19d0ee3c6f93ff5a63 Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Fri, 15 Aug 2025 09:33:24 +1200 Subject: [PATCH 2/3] third_party:quic Fix compilation with clang-20 Add -Wno-error=format-nonliteral so that quic builds with clang 20 ../../third_party/quic/libquic/handshake.c:106:35: error: format string is not a string literal [-Werror,-Wformat-nonliteral] 106 | rc = vsnprintf(msg, sizeof(msg), fmt, arg); | ^~~ ../../third_party/quic/libquic/handshake.c:135:35: error: format string is not a string literal [-Werror,-Wformat-nonliteral] 135 | rc = vsnprintf(msg, sizeof(msg), fmt, arg); | ^~~ ../../third_party/quic/libquic/handshake.c:164:35: error: format string is not a string literal [-Werror,-Wformat-nonliteral] 164 | rc = vsnprintf(msg, sizeof(msg), fmt, arg); | ^~~ BUG: https://bugzilla.samba.org/show_bug.cgi?id=15896 Signed-off-by: Gary Lockyer Reviewed-by: Stefan Metzmacher (cherry picked from commit de7932ea8d12348208f50f7b050b826d236ea597) --- third_party/quic/wscript | 3 +++ 1 file changed, 3 insertions(+) diff --git a/third_party/quic/wscript b/third_party/quic/wscript index ab5cceab70b..6ad6096e476 100644 --- a/third_party/quic/wscript +++ b/third_party/quic/wscript @@ -42,6 +42,9 @@ def configure(conf): conf.ADD_NAMED_CFLAGS('LIBQUIC_UNPICKY_CFLAGS', '-Wno-error=cast-qual', testflags=True) + conf.ADD_NAMED_CFLAGS('LIBQUIC_UNPICKY_CFLAGS', + '-Wno-error=format-nonliteral', + testflags=True) conf.DEFINE('HAVE_LIBQUIC', '1') return -- 2.43.0 From ef03a2083ac0b5b5268102172035a97c5578b28e Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Fri, 15 Aug 2025 09:38:07 +1200 Subject: [PATCH 3/3] third_party:quic_ko_wrapper Fix compilation with clang-20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework the code to remove the non portable variable length array in the union. Based on the code in wrap_msghdr_add_cmsghdr(). NOTE: this removes the 64 bit alignment, which I think should be ok. ./../third_party/quic_ko_wrapper/quic_ko_wrapper.c:3523:11: error: fields must have a constant size: 'variable length array in structure' extension will never be supported 3523 | uint8_t cmbuf[cmspace]; | ^ 1 error generated. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15896 Signed-off-by: Gary Lockyer Reviewed-by: Stefan Metzmacher Autobuild-User(master): Björn Baumbach Autobuild-Date(master): Wed Aug 20 15:04:34 UTC 2025 on atb-devel-224 (cherry picked from commit 26065e1f1ee111f5ddfb64782638492af65aeb95) --- third_party/quic_ko_wrapper/quic_ko_wrapper.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/third_party/quic_ko_wrapper/quic_ko_wrapper.c b/third_party/quic_ko_wrapper/quic_ko_wrapper.c index 576d8809c67..977611fdb20 100644 --- a/third_party/quic_ko_wrapper/quic_ko_wrapper.c +++ b/third_party/quic_ko_wrapper/quic_ko_wrapper.c @@ -3518,15 +3518,12 @@ static void qwrap_msghdr_add_cmsghdr(struct msghdr *msg, { size_t cmlen = CMSG_LEN(len); size_t cmspace = CMSG_SPACE(len); - union { - uint64_t cmalign64; - uint8_t cmbuf[cmspace]; - } cmu; - void *cast_ptr = (void *)cmu.cmbuf; + uint8_t cmbuf[cmspace]; + void *cast_ptr = (void *)cmbuf; struct cmsghdr *cm = (struct cmsghdr *)cast_ptr; uint8_t *p; - memset(cmu.cmbuf, 0, cmspace); + memset(cmbuf, 0, cmspace); if (msg->msg_controllen < cmlen) { cmlen = msg->msg_controllen; -- 2.43.0