Closed valpackett closed 4 years ago
Something is wrong (non-portable) with the cmsg parsing: the slice passed to clone_into_array in the tests ends up being [0, 0, 1, 2].
Thanks for the report. I'll take a look when I have a chance.
(btw, why is the parsing fully custom? The libc crate provides CMSG_FIRSTHDR, CMSG_NXTHDR, CMSG_DATA, CMSG_LEN and the nix crate has a nice wrapper that uses them)
We used nix originally, but found it wasn't possible to ship with Gecko due to minimum libc/kernel requirements that were higher than Gecko's (nix issue #737). IIRC, I forked the CMSG handling code to reuse in this project but it was replaced during a large refactor with the current slightly less portable version.
The CMSG_* functionality wasn't exported from Rust's libc at the time this code was written. I looked at switching recently, but it's not a panacea as CMSG_ALIGN (non-standard Linux extension) is missing and we need a portable equivalent in cmsg.rs.
It may be that using a small C extension to access the necessary CMSG_* goop on each OS is the best approach for us.
Nice, thanks!
Something is wrong (non-portable) with the cmsg parsing: the slice passed to
clone_into_array
in the tests ends up being[0, 0, 1, 2]
.(btw, why is the parsing fully custom? The
libc
crate providesCMSG_FIRSTHDR, CMSG_NXTHDR, CMSG_DATA, CMSG_LEN
and thenix
crate has a nice wrapper that uses them)