diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-01-23 21:56:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-23 21:56:25 +0000 |
commit | ae2b7b3552f3b800ab0f5e92dad06cd2e7df25e6 (patch) | |
tree | 352a7c533d5d4e0fe71e31181fa14abbc1ddee90 /src/sys/socket/addr.rs | |
parent | 4c3001b0b20b325122f7843d25e9f1089946a6da (diff) | |
parent | ad7e3c719ce43e0210e71763109c42383ee5aa33 (diff) | |
download | nix-ae2b7b3552f3b800ab0f5e92dad06cd2e7df25e6.zip |
Merge #1642
1642: InetAddr::from_std should set sin_len/sin6_len on the BSDs r=asomers a=rtzoeller
Resolves #1246.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
Diffstat (limited to 'src/sys/socket/addr.rs')
-rw-r--r-- | src/sys/socket/addr.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 67e5d6c6..4517c548 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -330,6 +330,11 @@ impl InetAddr { match *std { net::SocketAddr::V4(ref addr) => { InetAddr::V4(libc::sockaddr_in { + #[cfg(any(target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "hermit", + target_os = "ios", target_os = "macos", + target_os = "netbsd", target_os = "openbsd"))] + sin_len: mem::size_of::<libc::sockaddr_in>() as u8, sin_family: AddressFamily::Inet as sa_family_t, sin_port: addr.port().to_be(), // network byte order sin_addr: Ipv4Addr::from_std(addr.ip()).0, @@ -338,6 +343,11 @@ impl InetAddr { } net::SocketAddr::V6(ref addr) => { InetAddr::V6(libc::sockaddr_in6 { + #[cfg(any(target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "hermit", + target_os = "ios", target_os = "macos", + target_os = "netbsd", target_os = "openbsd"))] + sin6_len: mem::size_of::<libc::sockaddr_in6>() as u8, sin6_family: AddressFamily::Inet6 as sa_family_t, sin6_port: addr.port().to_be(), // network byte order sin6_addr: Ipv6Addr::from_std(addr.ip()).0, |