From 9c020396d3b610731e5a34916a715bd922864555 Mon Sep 17 00:00:00 2001 From: Kenta Yasukawa Date: Wed, 12 Mar 2025 11:54:01 -0400 Subject: [PATCH] Linux has defined IPV6_HDRINCL that is a different number than IP_HDRINCL. This patch adds a configuration that alters the value to set in set_header_included_v6() --- src/socket.rs | 3 +++ src/sys/unix.rs | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/socket.rs b/src/socket.rs index 1bed96f5..7f2a1edf 100644 --- a/src/socket.rs +++ b/src/socket.rs @@ -1674,6 +1674,9 @@ impl Socket { setsockopt( self.as_raw(), sys::IPPROTO_IPV6, + #[cfg(target_os = "linux")] + sys::IPV6_HDRINCL, + #[cfg(not(target_os = "linux"))] sys::IP_HDRINCL, included as c_int, ) diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 37d0c3a6..8e24f4e5 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -124,6 +124,8 @@ pub(crate) use libc::SO_OOBINLINE; // Used in `Socket`. #[cfg(not(target_os = "nto"))] pub(crate) use libc::ipv6_mreq as Ipv6Mreq; +#[cfg(all(feature = "all", target_os = "linux"))] +pub(crate) use libc::IPV6_HDRINCL; #[cfg(all( feature = "all", not(any(