-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add struct ip_mreqn: ip multicast req with intf id #1555
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
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @gnzlbg (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
|
rust-lang.libc spar64 + mips64 tests failed but I cant see anything in the logs specific to this diff set ? |
|
There are sparc and mips linux targets, and the ABI of the type you added does not match the C ABI on those targets. Why, I don't know. Maybe the struct definition that you have added does not match the struct definition on those targets ? |
src/unix/linux_like/mod.rs
Outdated
| } | ||
|
|
||
| #[cfg(not(any(target_arch = "mips64", target_arch = "sparc64")))] | ||
| pub struct ip_mreqn { |
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.
This won't work. If you don't want to add this to all linux targets, you need to manually add this to the targets you want. I do however recommend finding the source code for this and checking out what mips and sparc do.
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.
i cant find any alternate versions of the struct in glibc, any ideas where else to look ?
|
in glibc I cant find any ip_mreqn struct specific to an architecture. I assume this struct is just not in the sparc64 / mips64 builds ? |
|
Which header file does expose it? |
|
struct ip_mreq is defined in inet/netinet/in.h |
|
So that's in this header: https://elixir.bootlin.com/linux/v5.4-rc2/source/include/uapi/linux/in.h#L173
It is available - we know because the C tests for it on sparc64 and mips64 use the type and they compile successfully, so a type definition must be available. |
|
So looking at the error, the test that's failing is the following. This struct has 3 fields, where each field is 4 bytes wide. The first two fields are a The test initializes the struct bytes in Rust to the following values: [0, 1, 2, 3, ..., 11]. It then passes the struct by value to a C function expecting it. This function then reads the bytes of the struct and verifies that they match the values set on the Rust side. This fails, reporting that the last 4 bytes (the ones of the That's weird. In particular, this is apparently the only test that fails there. That is, the struct sizes must match, so there can't be any padding between the Maybe you can just modify the |
|
thanks for looking into this, weird indeed. I will try modifying the build.rs |
|
If you need these now and don't have time to investigate that's ok, just add these structs to the platforms you need them, e.g., instead of to linux/, maybe only linux/gnu/x86_64 - copy pasting them isn't a problem. What we try to avoid is adding types that might be subtly broken on some platforms. In this case, it would cost a mips64 user quite a bit of time to figure out why C is crashing when passing it these types without actually writing some code that tries to print their value in C, because on the Rust side, everything looks fine. |
523758f to
666d3c7
Compare
|
all the other tests pass (when the roundtrip test is skipped) |
666d3c7 to
909bdfe
Compare
The ip_mreqn struct has an additional interface id parameter. This allows programming IPv4 multicast groups using the interface id alongside the src IPv4 address. Linux has supported the ip_mreqn struct since Linux 2.2 ref: man ip.7 [Adding to linux x86_64 only as adding to linux_like/mod.rs caused failures in the sparc64 and mips64 C regression tests]
909bdfe to
44b9022
Compare
Damn, so I don't know what might be going on. Maybe our ABI implementation on mips64 and sparc64 is borked somehow? cc @nagisa @nikic I'm going to open an issue to track investigating what's going on here. In the meantime, we can land this for x86_64, thanks @flocknetworks @bors: r+ |
|
📌 Commit 44b9022 has been approved by |
Add struct ip_mreqn: ip multicast req with intf id The ip_mreqn struct has an additional interface id parameter. This allows programming IPv4 multicast groups using the interface id alongside the src IPv4 address. Linux has supported the ip_mreqn struct since Linux 2.2 ref: man ip.7
|
💥 Test timed out |
|
@bors: retry |
Add struct ip_mreqn: ip multicast req with intf id The ip_mreqn struct has an additional interface id parameter. This allows programming IPv4 multicast groups using the interface id alongside the src IPv4 address. Linux has supported the ip_mreqn struct since Linux 2.2 ref: man ip.7
|
💔 Test failed - status-azure |
|
I'm assuming these failures are due to something in the CI infra rather than my diffs ? |
Add struct ip_mreqn: ip multicast req with intf id The ip_mreqn struct has an additional interface id parameter. This allows programming IPv4 multicast groups using the interface id alongside the src IPv4 address. Linux has supported the ip_mreqn struct since Linux 2.2 ref: man ip.7
|
@bors r- retry |
|
@bors: r+ |
|
📌 Commit 44b9022 has been approved by |
Add struct ip_mreqn: ip multicast req with intf id The ip_mreqn struct has an additional interface id parameter. This allows programming IPv4 multicast groups using the interface id alongside the src IPv4 address. Linux has supported the ip_mreqn struct since Linux 2.2 ref: man ip.7
|
☀️ Test successful - checks-cirrus-freebsd-10, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, status-azure |
The ip_mreqn struct has an additional interface id parameter. This
allows programming IPv4 multicast groups using the interface id
alongside the src IPv4 address.
Linux has supported the ip_mreqn struct since Linux 2.2
ref: man ip.7