diff --git a/noq-udp/src/cmsg/unix.rs b/noq-udp/src/cmsg/unix.rs index 386439411..26d28894e 100644 --- a/noq-udp/src/cmsg/unix.rs +++ b/noq-udp/src/cmsg/unix.rs @@ -15,7 +15,6 @@ use crate::imp::IpTosTy; #[repr(C)] #[allow(dead_code)] // the fields are here for their size, nothing reads them pub(crate) union Payload { - hdr: libc::cmsghdr, #[cfg(not(target_os = "netbsd"))] ecn_v4: IpTosTy, ecn_v6: c_int, @@ -75,7 +74,8 @@ pub(crate) const RECV_LEN: usize = 4 * MESSAGE_LEN; #[derive(Copy, Clone)] #[repr(C)] pub(crate) struct ControlBuf { - /// Aligns the buffer like the `size_t` the `CMSG_*` macros round offsets to. + /// Aligns the buffer like the `size_t` the `CMSG_*` macros round offsets to, which + /// covers the headers too: no platform aligns `cmsghdr` more strictly than that. /// Zero sized: `repr(align)` takes a literal, not an expression. _align: [usize; 0], bytes: [MaybeUninit; N], diff --git a/noq-udp/src/cmsg/windows.rs b/noq-udp/src/cmsg/windows.rs index 5eac7e387..3dea5cb07 100644 --- a/noq-udp/src/cmsg/windows.rs +++ b/noq-udp/src/cmsg/windows.rs @@ -18,7 +18,6 @@ use super::{CMsgHdr, Encoder, MsgHdr}; #[repr(C)] #[allow(dead_code)] // the fields are here for their size, nothing reads them pub(crate) union Payload { - hdr: WinSock::CMSGHDR, ecn: c_int, segment_size: u32, pktinfo_v4: WinSock::IN_PKTINFO, @@ -75,7 +74,8 @@ pub(crate) const RECV_LEN: usize = 3 * MESSAGE_LEN; #[derive(Copy, Clone)] #[repr(C)] pub(crate) struct ControlBuf { - /// Aligns the buffer like the `usize` `WSA_CMSGDATA_ALIGN` rounds to. + /// Aligns the buffer like the `usize` `WSA_CMSGDATA_ALIGN` rounds to, which covers + /// the headers too: `CMSGHDR` is a `SIZE_T` and two `INT`s. /// Zero sized: `repr(align)` takes a literal, not an expression. _align: [usize; 0], bytes: [MaybeUninit; N],