From c916e5274e49cc51ebfa1d0c10fd6c60a5d0683f Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Wed, 23 Jun 2021 16:19:50 +0200 Subject: [PATCH] Add IpFreebind socket option --- CHANGELOG.md | 2 ++ src/sys/socket/sockopt.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e04f02040..7898d42d51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Added `if_nameindex` (#[1445](https://github.com/nix-rust/nix/pull/1445)) - Added `nmount` for FreeBSD. (#[1447](https://github.com/nix-rust/nix/pull/1447)) +- Added `IpFreebind` socket option (sockopt) on Linux, Fuchsia and Android. + (#[1456](https://github.com/nix-rust/nix/pull/1456)) ### Changed ### Fixed diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index fe17395f72..a9764f6f5b 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -238,6 +238,8 @@ cfg_if! { } sockopt_impl!(Both, IpMulticastTtl, libc::IPPROTO_IP, libc::IP_MULTICAST_TTL, u8); sockopt_impl!(Both, IpMulticastLoop, libc::IPPROTO_IP, libc::IP_MULTICAST_LOOP, bool); +#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] +sockopt_impl!(Both, IpFreebind, libc::IPPROTO_IP, libc::IP_FREEBIND, bool); sockopt_impl!(Both, ReceiveTimeout, libc::SOL_SOCKET, libc::SO_RCVTIMEO, TimeVal); sockopt_impl!(Both, SendTimeout, libc::SOL_SOCKET, libc::SO_SNDTIMEO, TimeVal); sockopt_impl!(Both, Broadcast, libc::SOL_SOCKET, libc::SO_BROADCAST, bool);