Skip to content
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

IPPROTO_MAX has changed on newer versions of Linux #1896

Open
Aaron1011 opened this issue Sep 17, 2020 · 3 comments
Open

IPPROTO_MAX has changed on newer versions of Linux #1896

Aaron1011 opened this issue Sep 17, 2020 · 3 comments

Comments

@Aaron1011
Copy link
Member

In newer versions of Linux, an additional variant IPPROTO_MPTCP has been added: torvalds/linux@faf391c. This caused the value of IPPROTO_MAX to change from IPPROTO_MPLS + 1 = 256 to IPPROTO_MPTCP + 1 = 263

However, the libc crate currently defines IPPROTO_MAX as 256:

pub const IPPROTO_MAX: ::c_int = 256;

This causees libc-test to fail when run against a newer kernel version. I'm not really sure what IPPROTO_MPTCP is used for, but this seemed worth bringing up.

@tommythorn
Copy link

My just cloned repo (@61e5f91833272d8fa2a2fb6bede3add62218f627) fails libc-test on Ubuntu 20.10/AMD64 (beta) with

     Running /home/tommy/projects/Rust/libc/target/debug/deps/main-63261675787c2312
RUNNING ALL TESTS
bad IPPROTO_MAX value at byte 0: rust: 0 (0x0) != c 7 (0x7)
thread 'main' panicked at 'some tests failed', /home/tommy/projects/Rust/libc/target/debug/build/libc-test-e26fe6d8326278e5/out/main.rs:12:21

I presume this is related.

bors added a commit that referenced this issue Oct 24, 2020
linux: Add definitions for Multipath TCP

The Linux kernel recently gained support for [Multipath TCP](https://en.wikipedia.org/wiki/Multipath_TCP), a protocol which builds upon TCP. This patch adds `IPPROTO_MPTCP` to open new sockets and `TCP_ULP` to query the upper layer protocol of traditional TCP sockets (which is set to `mptcp` for all underlying connections)

Source: [tcp: Define IPPROTO_MPTCP](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=faf391c3826cd29feae02078ca2022d2f912f7cc)

cc #1896
@joshtriplett
Copy link
Member

I think, in the future, we should avoid exposing the placeholder _MAX constants at the ends of enumerations, unless there's a specific compatibility reason we need to do so.

In the meantime, I think we should update the value of this.

@nathaniel-bennett
Copy link
Contributor

Would it be a good idea to remove this and similar _MAX constants in the 1.0 release to prevent this issue from happening again?

@tgross35 tgross35 added this to the 1.0 milestone Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants