From 5378cceff0fc5693caa6619e23f431726f7e150e Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sun, 6 Aug 2023 07:50:17 +0100 Subject: [PATCH 1/2] Adding new sockopt entries for FreeBSD related to routing --- src/sys/socket/sockopt.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 0d675ffb01..317d73f2cf 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -746,6 +746,26 @@ sockopt_impl!( libc::IP_BINDANY, bool ); +#[cfg(target_os = "freebsd")] +sockopt_impl!( + /// Set the route table (FIB) for this socket up to the `net.fibs` OID limit + /// (more specific than the setfib command line/call which are process based). + Fib, + SetOnly, + libc::SOL_SOCKET, + libc::SO_SETFIB, + i32 +); +#[cfg(target_os = "freebsd")] +sockopt_impl!( + /// Set `so_user_cookie` for this socket allowing network traffic based + /// upon it, similar to Linux's netfilter MARK. + UserCookie, + SetOnly, + libc::SOL_SOCKET, + libc::SO_USER_COOKIE, + u32 +); #[cfg(target_os = "linux")] sockopt_impl!( /// Set the mark for each packet sent through this socket (similar to the From 8e4150e8cd4c3ac74b885313569fdb2440a99e91 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sun, 6 Aug 2023 07:53:05 +0100 Subject: [PATCH 2/2] adding changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56b9b7d9f9..6962d6858e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Added `SOF_TIMESTAMPING_OPT_ID` and `SOF_TIMESTAMPING_OPT_TSONLY` to `nix::sys::socket::TimestampingFlag`. ([#2048](https://github.com/nix-rust/nix/pull/2048)) - Enabled socket timestamping options on Android. ([#2077](https://github.com/nix-rust/nix/pull/2077)) +- Added `SO_SETFIB` and `SO_USER_COOKIE` to `nix::sys::socket::sockopt` for FreeBSD. + ([#2085](https://github.com/nix-rust/nix/pull/2085)) ### Changed