Skip to content

Commit 2ab1eaf

Browse files
committed
sockopt add OpenBSD's SO_RTABLE to set the route table.
Also SO_ACCEPTFILTER for FreeBSD/NetBSD.
1 parent 78a4d9e commit 2ab1eaf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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)