diff options
author | James Peach <jpeach@apache.org> | 2016-05-01 17:56:48 -0700 |
---|---|---|
committer | James Peach <jpeach@apache.org> | 2016-05-01 17:56:48 -0700 |
commit | 2b7f92a43a7b30e2e2b8f9023e75f1a5d971992a (patch) | |
tree | c0fd4ea42fe3f54f3ca58279242078c99c6ce778 /src/sys/socket/mod.rs | |
parent | 5fa5fd49fb7c9655dc71f2bdb272cb85df317bfb (diff) | |
download | nix-2b7f92a43a7b30e2e2b8f9023e75f1a5d971992a.zip |
Support sockaddr_nl in sockaddr_storage_to_addr().
Add support for converting AF_NETLINK sockaddr_nl addresses to
Sockaddr::Netlink(). This lets socket::recvmsg() work on netlink
sockets.
Diffstat (limited to 'src/sys/socket/mod.rs')
-rw-r--r-- | src/sys/socket/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index c96a5c8d..0846eaf5 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -630,6 +630,11 @@ pub unsafe fn sockaddr_storage_to_addr( consts::AF_UNIX => { Ok(SockAddr::Unix(UnixAddr(*(addr as *const _ as *const sockaddr_un), len))) } + #[cfg(any(target_os = "linux", target_os = "android"))] + consts::AF_NETLINK => { + use libc::sockaddr_nl; + Ok(SockAddr::Netlink(NetlinkAddr(*(addr as *const _ as *const sockaddr_nl)))) + } af => panic!("unexpected address family {}", af), } } |