diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e33f33fe..54295f5d81 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 38b910f1a1..11ed329fb7 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::()); + 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 {