Skip to content

Commit

Permalink
Define IPPROTO_ETHERNET on Linux-like platforms.
Browse files Browse the repository at this point in the history
Define the `IPPROTO_ETHERNET` constant on Linux-like platforms.

This value is also now a registered protocol number IANA, called "Ethernet":

https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
  • Loading branch information
sunfishcode committed Jun 13, 2023
1 parent e06d905 commit 938a9a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libc-test/build.rs
Expand Up @@ -1799,7 +1799,7 @@ fn test_android(target: &str) {
| "MADV_POPULATE_WRITE" => true,

// kernel 5.6 minimum required
"IPPROTO_MPTCP" => true,
"IPPROTO_MPTCP" | "IPPROTO_ETHERNET" => true,

_ => false,
}
Expand Down Expand Up @@ -3578,6 +3578,7 @@ fn test_linux(target: &str) {

// IPPROTO_MAX was increased in 5.6 for IPPROTO_MPTCP:
| "IPPROTO_MAX"
| "IPPROTO_ETHERNET"
| "IPPROTO_MPTCP" => true,

// FIXME: Not currently available in headers
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/linux.txt
Expand Up @@ -1041,6 +1041,7 @@ IPPROTO_DSTOPTS
IPPROTO_EGP
IPPROTO_ENCAP
IPPROTO_ESP
IPPROTO_ETHERNET
IPPROTO_FRAGMENT
IPPROTO_GRE
IPPROTO_HOPOPTS
Expand Down
2 changes: 2 additions & 0 deletions src/unix/linux_like/mod.rs
Expand Up @@ -918,6 +918,8 @@ pub const IPPROTO_BEETPH: ::c_int = 94;
pub const IPPROTO_MPLS: ::c_int = 137;
/// Multipath TCP
pub const IPPROTO_MPTCP: ::c_int = 262;
/// Ethernet-within-IPv6 encapsulation.
pub const IPPROTO_ETHERNET: ::c_int = 143;

pub const MCAST_EXCLUDE: ::c_int = 0;
pub const MCAST_INCLUDE: ::c_int = 1;
Expand Down

0 comments on commit 938a9a3

Please sign in to comment.