From 37dea7be27f9e5bbbc78590a03ebdce978753686 Mon Sep 17 00:00:00 2001 From: Justin Latimer Date: Thu, 11 Jan 2018 02:06:50 +0000 Subject: [PATCH] Add socket options for IP_TRANSPARENT / BIND_ANY --- CHANGELOG.md | 2 ++ src/sys/socket/sockopt.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97ded53c57..2181c3d330 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ([#826](https://github.com/nix-rust/nix/pull/826)) - Added `nix::sys::socket::LinkAddr` on Linux and all bsdlike system. ([#813](https://github.com/nix-rust/nix/pull/813)) +- Add socket options for `IP_TRANSPARENT` / `BIND_ANY`. + ([#835](https://github.com/nix-rust/nix/pull/835)) ### Changed - Use native `pipe2` on all BSD targets. Users should notice no difference. diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 065d3101cf..0f0fdd2e4d 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -179,6 +179,12 @@ sockopt_impl!(GetOnly, AcceptConn, libc::SOL_SOCKET, libc::SO_ACCEPTCONN, bool); #[cfg(any(target_os = "linux", target_os = "android"))] sockopt_impl!(GetOnly, OriginalDst, libc::SOL_IP, libc::SO_ORIGINAL_DST, libc::sockaddr_in); sockopt_impl!(Both, ReceiveTimestamp, libc::SOL_SOCKET, libc::SO_TIMESTAMP, bool); +#[cfg(any(target_os = "linux", target_os = "android"))] +sockopt_impl!(Both, IpTransparent, libc::SOL_IP, libc::IP_TRANSPARENT, bool); +#[cfg(target_os = "openbsd")] +sockopt_impl!(Both, BindAny, libc::SOL_SOCKET, libc::SO_BINDANY, bool); +#[cfg(target_os = "freebsd")] +sockopt_impl!(Both, BindAny, libc::IPPROTO_IP, libc::IP_BINDANY, bool); /* *