2088: sockopt add OpenBSD's SO_RTABLE to set the route table. r=asomers a=devnexen

Also SO_ACCEPTFILTER for FreeBSD/NetBSD.

Co-authored-by: David Carlier <devnexen@gmail.com>
Co-authored-by: David CARLIER <devnexen@gmail.com>
This commit is contained in:
bors[bot] 2023-08-06 23:24:32 +00:00 committed by GitHub
commit f9d3a224e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -24,6 +24,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Added vsock support for macOS ([#2056](https://github.com/nix-rust/nix/pull/2056))
- Added `SO_SETFIB` and `SO_USER_COOKIE` to `nix::sys::socket::sockopt` for FreeBSD.
([#2085](https://github.com/nix-rust/nix/pull/2085))
- Added `SO_RTABLE` for OpenBSD and `SO_ACCEPTFILTER` for FreeBSD/NetBSD to `nix::sys::socket::sockopt`.
([#2085](https://github.com/nix-rust/nix/pull/2085))
### Changed

View File

@ -766,6 +766,26 @@ sockopt_impl!(
libc::SO_USER_COOKIE,
u32
);
#[cfg(target_os = "openbsd")]
sockopt_impl!(
/// Set the route table for this socket, needs a privileged user if
/// the process/socket had been set to the non default route.
Rtable,
SetOnly,
libc::SOL_SOCKET,
libc::SO_RTABLE,
i32
);
#[cfg(any(target_os = "freebsd", target_os = "netbsd"))]
sockopt_impl!(
/// Get/set a filter on this socket before accepting connections similarly
/// to Linux's TCP_DEFER_ACCEPT but after the listen's call.
AcceptFilter,
Both,
libc::SOL_SOCKET,
libc::SO_ACCEPTFILTER,
libc::accept_filter_arg
);
#[cfg(target_os = "linux")]
sockopt_impl!(
/// Set the mark for each packet sent through this socket (similar to the