Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new sockopt entries for FreeBSD related to routing #2085

Merged
merged 2 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 20 additions & 0 deletions src/sys/socket/sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down