Skip to content

Commit

Permalink
Merge #1768
Browse files Browse the repository at this point in the history
1768: Add ETH_P_ALL protocol number to SockProtocol r=asomers a=valdaarhun

Hi. I am working on a networking project that uses [packet sockets](https://man7.org/linux/man-pages/man7/packet.7.html) and noticed that ETH_P_ALL is not there in the `SockProtocol` enum. I thought it would be nice to have it here alongside IPPROTO_TCP and IPPROTO_UDP instead of having to separately import it from the libc crate.

Co-authored-by: valdaarhun <icegambit91@gmail.com>
  • Loading branch information
bors[bot] and valdaarhun committed Jul 24, 2022
2 parents 7cc33c1 + 1040d97 commit 00f6981
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased] - ReleaseDate
### Added

- Added ETH_P_ALL to SockProtocol enum
(#[1768](https://github.com/nix-rust/nix/pull/1768))
- Added four non-standard Linux `SysconfVar` variants
(#[1761](https://github.com/nix-rust/nix/pull/1761))
- Added const constructors for `TimeSpec` and `TimeVal`
Expand Down
7 changes: 7 additions & 0 deletions src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ pub enum SockProtocol {
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
NetlinkCrypto = libc::NETLINK_CRYPTO,
/// Non-DIX type protocol number defined for the Ethernet IEEE 802.3 interface that allows packets of all protocols
/// defined in the interface to be received.
/// ([ref](https://man7.org/linux/man-pages/man7/packet.7.html))
// The protocol number is fed into the socket syscall in network byte order.
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg_attr(docsrs, doc(cfg(all())))]
EthAll = libc::ETH_P_ALL.to_be(),
}

#[cfg(any(target_os = "linux"))]
Expand Down

0 comments on commit 00f6981

Please sign in to comment.