diff --git a/changelog/2113.added.md b/changelog/2113.added.md new file mode 100644 index 0000000000..be654b5dd5 --- /dev/null +++ b/changelog/2113.added.md @@ -0,0 +1 @@ +Add socket option `IPV6_PKTINFO` for BSDs/Linux/Android, also `IPV6_RECVPKTINFO` for DragonFlyBSD \ No newline at end of file diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 810340041d..0b6b07a948 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -905,7 +905,7 @@ sockopt_impl!( libc::IP_PKTINFO, bool ); -#[cfg(any(linux_android, target_os = "freebsd", apple_targets, netbsdlike))] +#[cfg(any(linux_android, bsd))] #[cfg(feature = "net")] sockopt_impl!( #[cfg_attr(docsrs, doc(cfg(feature = "net")))] @@ -917,6 +917,19 @@ sockopt_impl!( libc::IPV6_RECVPKTINFO, bool ); + +#[cfg(any(linux_android, bsd))] +#[cfg(feature = "net")] +sockopt_impl!( + #[cfg_attr(docsrs, doc(cfg(feature = "net")))] + /// Pass an `IPV6_PKTINFO` ancillary message that contains a in6_pktinfo + /// structure that supplies some information about the incoming packet. + Ipv6PacketInfo, + Both, + libc::IPPROTO_IPV6, + libc::IPV6_PKTINFO, + bool +); #[cfg(bsd)] #[cfg(feature = "net")] sockopt_impl!(