From 5756d7ff7bbd87da1db92c1dc2d2f13911e7f7ed Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 27 Sep 2023 12:40:07 -0700 Subject: [PATCH] DragonFly doesn't have `IP_RECVTOS`. --- src/backend/libc/net/sockopt.rs | 4 ++-- src/net/sockopt.rs | 4 ++-- tests/net/sockopt.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/libc/net/sockopt.rs b/src/backend/libc/net/sockopt.rs index 02695a4c5..29c87f541 100644 --- a/src/backend/libc/net/sockopt.rs +++ b/src/backend/libc/net/sockopt.rs @@ -568,13 +568,13 @@ pub(crate) fn get_ip_tos(fd: BorrowedFd<'_>) -> io::Result { Ok(value as u8) } -#[cfg(any(apple, freebsdlike, linux_like, target_os = "fuchsia"))] +#[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))] #[inline] pub(crate) fn set_ip_recvtos(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> { setsockopt(fd, c::IPPROTO_IP, c::IP_RECVTOS, from_bool(value)) } -#[cfg(any(apple, freebsdlike, linux_like, target_os = "fuchsia"))] +#[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))] #[inline] pub(crate) fn get_ip_recvtos(fd: BorrowedFd<'_>) -> io::Result { getsockopt(fd, c::IPPROTO_IP, c::IP_RECVTOS).map(to_bool) diff --git a/src/net/sockopt.rs b/src/net/sockopt.rs index 66f48f5bd..ea736c2af 100644 --- a/src/net/sockopt.rs +++ b/src/net/sockopt.rs @@ -834,7 +834,7 @@ pub fn get_ip_tos(fd: Fd) -> io::Result { /// See the [module-level documentation] for more. /// /// [module-level documentation]: self#references-for-get_ip_-and-set_ip_-functions -#[cfg(any(apple, freebsdlike, linux_like, target_os = "fuchsia"))] +#[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))] #[inline] #[doc(alias = "IP_RECVTOS")] pub fn set_ip_recvtos(fd: Fd, value: bool) -> io::Result<()> { @@ -846,7 +846,7 @@ pub fn set_ip_recvtos(fd: Fd, value: bool) -> io::Result<()> { /// See the [module-level documentation] for more. /// /// [module-level documentation]: self#references-for-get_ip_-and-set_ip_-functions -#[cfg(any(apple, freebsdlike, linux_like, target_os = "fuchsia"))] +#[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))] #[inline] #[doc(alias = "IP_RECVTOS")] pub fn get_ip_recvtos(fd: Fd) -> io::Result { diff --git a/tests/net/sockopt.rs b/tests/net/sockopt.rs index 7ddbfe614..69b7be6aa 100644 --- a/tests/net/sockopt.rs +++ b/tests/net/sockopt.rs @@ -226,7 +226,7 @@ fn test_sockopts_ipv4() { } // Check the initial value of IP RECVTOS, set it, and check it. - #[cfg(any(apple, freebsdlike, linux_like, target_os = "fuchsia"))] + #[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))] { assert!(!sockopt::get_ip_recvtos(&s).unwrap()); sockopt::set_ip_recvtos(&s, true).unwrap();