Skip to content

Commit

Permalink
Merge #1848
Browse files Browse the repository at this point in the history
1848: SockProtocol::Raw = libc::IPPROTO_RAW for raw sockets r=asomers a=StackOverflowExcept1on

Hey, I wanna to make call like `socket(af_type, SOCK_RAW, IPPROTO_RAW)` but currently there is no way to do it with rust
https://github.com/rickettm/SendIP/blob/aad12a001157489ab9053c8665e09aec24a2ff6d/sendip.c#L143

Update: Feel free to add `#[cfg]` attribute if I made mistakes that might cause errors on some platforms

Co-authored-by: StackOverflowExcept1on <[email protected]>
  • Loading branch information
bors[bot] and StackOverflowExcept1on authored Nov 21, 2022
2 parents 8522191 + 3859798 commit a75a349
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
([#1853](https://github.com/nix-rust/nix/pull/1853))
- Added `new_unnamed` and `is_unnamed` for `UnixAddr` on Linux and Android.
([#1857](https://github.com/nix-rust/nix/pull/1857))
- Added `SockProtocol::Raw` for raw sockets
([#1848](https://github.com/nix-rust/nix/pull/1848))

### Changed

Expand Down
2 changes: 2 additions & 0 deletions src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ pub enum SockProtocol {
Tcp = libc::IPPROTO_TCP,
/// UDP protocol ([ip(7)](https://man7.org/linux/man-pages/man7/ip.7.html))
Udp = libc::IPPROTO_UDP,
/// Raw sockets ([raw(7)](https://man7.org/linux/man-pages/man7/raw.7.html))
Raw = libc::IPPROTO_RAW,
/// Allows applications and other KEXTs to be notified when certain kernel events occur
/// ([ref](https://developer.apple.com/library/content/documentation/Darwin/Conceptual/NKEConceptual/control/control.html))
#[cfg(any(target_os = "ios", target_os = "macos"))]
Expand Down

0 comments on commit a75a349

Please sign in to comment.