From 5ef78a8b17a893e7534a4c02d34f636cfe4d87e0 Mon Sep 17 00:00:00 2001 From: Gilad Naaman <70581924+gnaaman-dn@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:29:57 +0200 Subject: [PATCH] Add Sctp protocol and MSG_NOTIFICATION (#2562) --- changelog/2562.added.md | 1 + src/sys/socket/mod.rs | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 changelog/2562.added.md diff --git a/changelog/2562.added.md b/changelog/2562.added.md new file mode 100644 index 0000000000..432963c247 --- /dev/null +++ b/changelog/2562.added.md @@ -0,0 +1 @@ +Add socket protocol `Sctp`, as well as `MSG_NOTIFICATION` for non-Android Linux targets. diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index dd5367b1c3..8b35a9f626 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -213,6 +213,14 @@ pub enum SockProtocol { Icmp = libc::IPPROTO_ICMP, /// ICMPv6 protocol (ICMP over IPv6) IcmpV6 = libc::IPPROTO_ICMPV6, + /// SCTP ([sctp(7)](https://man7.org/linux/man-pages/man7/sctp.7.html)) + #[cfg(any( + apple_targets, + linux_android, + target_os = "freebsd", + target_os = "netbsd" + ))] + Sctp = libc::IPPROTO_SCTP, } impl SockProtocol { @@ -356,6 +364,9 @@ libc_bitflags! { target_os = "fuchsia", target_os = "freebsd"))] MSG_WAITFORONE; + /// Indicates that this message is not a user message but an SCTP notification. + #[cfg(target_os = "linux")] + MSG_NOTIFICATION; } }