Skip to content

Commit

Permalink
Support sockaddr_nl in sockaddr_storage_to_addr().
Browse files Browse the repository at this point in the history
Add support for converting AF_NETLINK  sockaddr_nl addresses to
Sockaddr::Netlink(). This lets socket::recvmsg() work on netlink
sockets.
  • Loading branch information
jpeach committed May 2, 2016
1 parent 5fa5fd4 commit 2b7f92a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
Expand Down

0 comments on commit 2b7f92a

Please sign in to comment.