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.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Wed Aug 20 15:04:34 UTC 2025 on atb-devel-224
{
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;