Skip to content

Commit 00f6981

Browse files
Merge #1768
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>
2 parents 7cc33c1 + 1040d97 commit 00f6981

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
66
## [Unreleased] - ReleaseDate
77
### Added
88

9+
- Added ETH_P_ALL to SockProtocol enum
10+
(#[1768](https://github.com/nix-rust/nix/pull/1768))
911
- Added four non-standard Linux `SysconfVar` variants
1012
(#[1761](https://github.com/nix-rust/nix/pull/1761))
1113
- Added const constructors for `TimeSpec` and `TimeVal`

src/sys/socket/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ pub enum SockProtocol {
214214
#[cfg(any(target_os = "android", target_os = "linux"))]
215215
#[cfg_attr(docsrs, doc(cfg(all())))]
216216
NetlinkCrypto = libc::NETLINK_CRYPTO,
217+
/// Non-DIX type protocol number defined for the Ethernet IEEE 802.3 interface that allows packets of all protocols
218+
/// defined in the interface to be received.
219+
/// ([ref](https://man7.org/linux/man-pages/man7/packet.7.html))
220+
// The protocol number is fed into the socket syscall in network byte order.
221+
#[cfg(any(target_os = "android", target_os = "linux"))]
222+
#[cfg_attr(docsrs, doc(cfg(all())))]
223+
EthAll = libc::ETH_P_ALL.to_be(),
217224
}
218225

219226
#[cfg(any(target_os = "linux"))]

0 commit comments

Comments
 (0)