diff options
author | Justin Ossevoort <github@internetionals.nl> | 2020-11-27 21:52:35 +0100 |
---|---|---|
committer | Justin Ossevoort <justin.ossevoort@tesorion.nl> | 2021-01-04 14:02:28 +0100 |
commit | 867cb7d468d72ddb6aab2067d1757212dc6233b8 (patch) | |
tree | e3715a4207a4ddd8acfa17904c228625eb77022e | |
parent | c0c55700df23cf4a8b2d1f0f7f4a06b013dab59a (diff) | |
download | nix-867cb7d468d72ddb6aab2067d1757212dc6233b8.zip |
Add support for when receiving packets
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | src/sys/socket/mod.rs | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e33f33..54295f5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - i686-apple-darwin has been demoted to Tier 2 support, because it's deprecated by Xcode. (#[1350](https://github.com/nix-rust/nix/pull/1350)) +- Fixed calling `recvfrom` on an `AddrFamily::Packet` socket + (#[1344](https://github.com/nix-rust/nix/pull/1344)) ### Removed diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 38b910f1..11ed329f 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -1702,6 +1702,15 @@ pub fn sockaddr_storage_to_addr( Ok(SockAddr::Unix(UnixAddr(sun, pathlen))) } #[cfg(any(target_os = "android", target_os = "linux"))] + libc::AF_PACKET => { + use libc::sockaddr_ll; + assert_eq!(len as usize, mem::size_of::<sockaddr_ll>()); + let sll = unsafe { + *(addr as *const _ as *const sockaddr_ll) + }; + Ok(SockAddr::Link(LinkAddr(sll))) + } + #[cfg(any(target_os = "android", target_os = "linux"))] libc::AF_NETLINK => { use libc::sockaddr_nl; let snl = unsafe { |