-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[0.2] Add additional Linux AF_PACKET options #3540
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
Conversation
|
r? @JohnTitor (rustbot has picked a reviewer for you, use r? to override) |
375d15a to
c7a3466
Compare
|
Sorry but could you add cfgs here? 0.2's MSRV is 1.13 and we need to add them, see https://github.com/rust-lang/libc/tree/libc-0.2#rust-version-support. |
c7a3466 to
37539c6
Compare
|
Added cfgs for union types in latest force-push |
|
CI fails, seems you also need |
37539c6 to
3f3b9b6
Compare
|
Added libc_align cfg to any structs that use |
d48b986 to
d0e72e9
Compare
8b168d1 to
e5e8b78
Compare
af37ff7 to
ed656e0
Compare
|
This is a big-ish API surface so it's still taking me a while to going through it. Feel free to hold off rebasing until I get back to you. Some brief notes below. |
libc-test/build.rs
Outdated
| // FIXME: pass by value for structs that are not an even 32/64 bits on | ||
| // big-endian systems corrupts the value for unknown reasons. | ||
| if (sparc64 || ppc || ppc64 || s390x) | ||
| && (ty == "sockaddr_pkt" | ||
| || ty == "tpacket_auxdata" | ||
| || ty == "tpacket_hdr_variant1" | ||
| || ty == "tpacket_req3" | ||
| || ty == "tpacket_stats_v3" | ||
| || ty == "tpacket_req_u") | ||
| { | ||
| return true; | ||
| } | ||
| // FIXME: musl doesn't compile with `struct fanout_args` for unknown reasons. | ||
| if musl && ty == "fanout_args" { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these unknown reasons, or what is the error? Ideally we link actual rust-lang/rust issues here so we know when this can be removed.
src/unix/linux_like/linux/align.rs
Outdated
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks spurious
src/unix/linux_like/linux/mod.rs
Outdated
| #[cfg(libc_union)] | ||
| impl ::fmt::Debug for tpacket_req_u { | ||
| fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | ||
| f.debug_struct("tpacket_req_u") | ||
| .field("req3", unsafe { &self.req3 }) | ||
| .finish() | ||
| } | ||
| } | ||
|
|
||
| #[cfg(libc_union)] | ||
| impl ::fmt::Debug for tpacket_bd_header_u { | ||
| fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | ||
| f.debug_struct("tpacket_bd_header_u") | ||
| .field("bh1", unsafe { &self.bh1 }) | ||
| .finish() | ||
| } | ||
| } | ||
|
|
||
| #[cfg(libc_union)] | ||
| impl ::fmt::Debug for tpacket_block_desc { | ||
| fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { | ||
| f.debug_struct("tpacket_bd_header_u") | ||
| .field("version", &self.version) | ||
| .field("offset_to_priv", &self.offset_to_priv) | ||
| .field("hdr", &self.hdr) | ||
| .finish() | ||
| } | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading req3 on tpacket_req_u reads potentially uninitialized data if the variant is actually req. It is probably best to just drop these Debug implementations entirely, considering they may be removed anyway in 1.0.
ed656e0 to
f402cbe
Compare
|
Linked to (rust-lang/rust#43894), removed the spurious whitespace, and dropped the |
f402cbe to
f3ba4d0
Compare
f3ba4d0 to
a0ac2f1
Compare
|
@rustbot label S-waiting-on-review |
|
@rustbot label -S-waiting-on-author |
Added socket options, structs and other miscellaneous constants that make memory-mapped packet sockets possible in Linux--PACKET_TX_RING, PACKET_RX_RING, etc.
(adding this to libc 0.2 as 0.3 is in early development)