-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to construct an in6_addr #58
Comments
This fixes libpnet to an older version of libc, until this is fixed.
Workaround rust-lang/libc#58. This fixes libpnet to an older version of libc, until this is fixed. See also: rust-lang/libc#58.
Thanks for the report! This has also been reported here and here, and unfortunately this is just a place where Rust doesn't handle FFI unions very well right now. The underlying type is a union which gains it higher alignment but the exposed fields right now don't give us that alignment. When we have custom alignment we may be able to get around this via other means, but for now you can construct this like you would in C: let mut foo: libc::in6_addr = mem::uninitialized();
// initialize foo.s6_addr
return foo Which is to say it's not necessarily "impossible", just not very idiomatic! |
Thanks you. Sorry for the noise, I didn't find those issues when I searched for some reason. |
It should be possible to replace __align with Edit turns out I am: |
Add C++ support and support renaming consts
The new definition of
in6_addr
:Link: https://github.com/rust-lang-nursery/libc/blob/e7ff66ba3df6eb0d10953245a2a6fd2ecf082ccd/src/unix/mod.rs#L62
Means that it is now impossible to construct a value of type
in6_addr
from Rust, outside of the libc crate, since the __align field is private. I've had to fix libpnet to an old version of libc to work around this.The text was updated successfully, but these errors were encountered: