mirror of
https://github.com/jiangcuo/nix.git
synced 2026-01-13 19:09:42 +00:00
feat: ControlMessageOwned::{Ipv4RecvIf,Ipv4RecvDstAddr} for DragonFlyBSD (#2240)
* feat: Enable ControlMessageOwned::{Ipv4RecvIf,Ipv4RecvDstAddr} for DragonFlyBSD
* fix DrafonFlyBSD
* fix Linux
* fix cfg
This commit is contained in:
parent
e95162f288
commit
a4e0c9544c
1
changelog/2240.added.md
Normal file
1
changelog/2240.added.md
Normal file
@ -0,0 +1 @@
|
||||
Enable `ControlMessageOwned::Ipv4RecvIf` and `ControlMessageOwned::Ipv4RecvDstAddr` for DragonFlyBSD
|
||||
@ -748,11 +748,11 @@ pub enum ControlMessageOwned {
|
||||
#[cfg(feature = "net")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
|
||||
Ipv6PacketInfo(libc::in6_pktinfo),
|
||||
#[cfg(any(target_os = "freebsd", apple_targets, netbsdlike))]
|
||||
#[cfg(bsd)]
|
||||
#[cfg(feature = "net")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
|
||||
Ipv4RecvIf(libc::sockaddr_dl),
|
||||
#[cfg(any(target_os = "freebsd", apple_targets, netbsdlike))]
|
||||
#[cfg(bsd)]
|
||||
#[cfg(feature = "net")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
|
||||
Ipv4RecvDstAddr(libc::in_addr),
|
||||
@ -931,13 +931,13 @@ impl ControlMessageOwned {
|
||||
let info = unsafe { ptr::read_unaligned(p as *const libc::in_pktinfo) };
|
||||
ControlMessageOwned::Ipv4PacketInfo(info)
|
||||
}
|
||||
#[cfg(any(target_os = "freebsd", apple_targets, netbsdlike))]
|
||||
#[cfg(bsd)]
|
||||
#[cfg(feature = "net")]
|
||||
(libc::IPPROTO_IP, libc::IP_RECVIF) => {
|
||||
let dl = unsafe { ptr::read_unaligned(p as *const libc::sockaddr_dl) };
|
||||
ControlMessageOwned::Ipv4RecvIf(dl)
|
||||
},
|
||||
#[cfg(any(target_os = "freebsd", apple_targets, netbsdlike))]
|
||||
#[cfg(bsd)]
|
||||
#[cfg(feature = "net")]
|
||||
(libc::IPPROTO_IP, libc::IP_RECVDSTADDR) => {
|
||||
let dl = unsafe { ptr::read_unaligned(p as *const libc::in_addr) };
|
||||
|
||||
@ -842,7 +842,7 @@ sockopt_impl!(
|
||||
libc::IPV6_RECVPKTINFO,
|
||||
bool
|
||||
);
|
||||
#[cfg(any(target_os = "freebsd", apple_targets, netbsdlike))]
|
||||
#[cfg(bsd)]
|
||||
#[cfg(feature = "net")]
|
||||
sockopt_impl!(
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
|
||||
@ -854,7 +854,7 @@ sockopt_impl!(
|
||||
libc::IP_RECVIF,
|
||||
bool
|
||||
);
|
||||
#[cfg(any(target_os = "freebsd", apple_targets, netbsdlike))]
|
||||
#[cfg(bsd)]
|
||||
#[cfg(feature = "net")]
|
||||
sockopt_impl!(
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
|
||||
|
||||
@ -1750,14 +1750,7 @@ pub fn test_syscontrol() {
|
||||
// connect(fd.as_raw_fd(), &sockaddr).expect("connect failed");
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
target_os = "freebsd",
|
||||
apple_targets,
|
||||
target_os = "linux",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd",
|
||||
))]
|
||||
#[cfg(any(bsd, linux_android))]
|
||||
fn loopback_address(
|
||||
family: AddressFamily,
|
||||
) -> Option<nix::ifaddrs::InterfaceAddress> {
|
||||
@ -1880,12 +1873,7 @@ pub fn test_recv_ipv4pktinfo() {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_os = "freebsd",
|
||||
apple_targets,
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd",
|
||||
))]
|
||||
#[cfg(bsd)]
|
||||
// qemu doesn't seem to be emulating this correctly in these architectures
|
||||
#[cfg_attr(
|
||||
all(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user