Skip to content

Commit f9d3a22

Browse files
bors[bot]devnexen
andauthored
Merge #2088
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>
2 parents 53b0332 + 3591ed8 commit f9d3a22

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
2424
- Added vsock support for macOS ([#2056](https://github.com/nix-rust/nix/pull/2056))
2525
- Added `SO_SETFIB` and `SO_USER_COOKIE` to `nix::sys::socket::sockopt` for FreeBSD.
2626
([#2085](https://github.com/nix-rust/nix/pull/2085))
27+
- Added `SO_RTABLE` for OpenBSD and `SO_ACCEPTFILTER` for FreeBSD/NetBSD to `nix::sys::socket::sockopt`.
28+
([#2085](https://github.com/nix-rust/nix/pull/2085))
2729

2830
### Changed
2931

src/sys/socket/sockopt.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,26 @@ sockopt_impl!(
766766
libc::SO_USER_COOKIE,
767767
u32
768768
);
769+
#[cfg(target_os = "openbsd")]
770+
sockopt_impl!(
771+
/// Set the route table for this socket, needs a privileged user if
772+
/// the process/socket had been set to the non default route.
773+
Rtable,
774+
SetOnly,
775+
libc::SOL_SOCKET,
776+
libc::SO_RTABLE,
777+
i32
778+
);
779+
#[cfg(any(target_os = "freebsd", target_os = "netbsd"))]
780+
sockopt_impl!(
781+
/// Get/set a filter on this socket before accepting connections similarly
782+
/// to Linux's TCP_DEFER_ACCEPT but after the listen's call.
783+
AcceptFilter,
784+
Both,
785+
libc::SOL_SOCKET,
786+
libc::SO_ACCEPTFILTER,
787+
libc::accept_filter_arg
788+
);
769789
#[cfg(target_os = "linux")]
770790
sockopt_impl!(
771791
/// Set the mark for each packet sent through this socket (similar to the

0 commit comments

Comments
 (0)