Skip to content

Commit d7ea5f7

Browse files
committed
socket::sockopt adding SOL_FILTER level options for illumos.
Respectively FIL_ATTACH/FIL_DETACH to bind/unbind a filter to a socket to for example delay connection acceptance until data (datafilt) is received.
1 parent e4895d3 commit d7ea5f7

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/sys/socket/sockopt.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,25 @@ sockopt_impl!(
987987
libc::SO_ACCEPTFILTER,
988988
libc::accept_filter_arg
989989
);
990+
#[cfg(target_os = "illumos")]
991+
sockopt_impl!(
992+
/// Attach a named filter to this socket to be able to
993+
/// defer when anough byte had been buffered by the kernel
994+
FilAttach,
995+
SetOnly,
996+
libc::SOL_FILTER,
997+
libc::FIL_ATTACH,
998+
SetOsString<'static>
999+
);
1000+
#[cfg(target_os = "illumos")]
1001+
sockopt_impl!(
1002+
/// Detach a socket filter previously attached with FIL_ATTACH
1003+
FilDetach,
1004+
SetOnly,
1005+
libc::SOL_FILTER,
1006+
libc::FIL_DETACH,
1007+
SetOsString<'static>
1008+
);
9901009
#[cfg(target_os = "linux")]
9911010
sockopt_impl!(
9921011
/// Set the mark for each packet sent through this socket (similar to the
@@ -1799,7 +1818,7 @@ pub struct SetOsString<'a> {
17991818
val: &'a OsStr,
18001819
}
18011820

1802-
#[cfg(any(target_os = "freebsd", linux_android))]
1821+
#[cfg(any(target_os = "freebsd", linux_android, target_os = "illumos"))]
18031822
impl<'a> Set<'a, OsString> for SetOsString<'a> {
18041823
fn new(val: &OsString) -> SetOsString {
18051824
SetOsString {

0 commit comments

Comments
 (0)