Hack around broken macOS ECN ABI

This commit is contained in:
Benjamin Saunders
2019-04-16 07:42:45 -07:00
committed by Dirkjan Ochtman
parent 3c1e0df5d0
commit f55dbaf8d0
+10 -1
View File
@@ -158,7 +158,16 @@ impl super::UdpExt for UdpSocket {
cmsg::decode::<u8>(cmsg)
},
(libc::IPPROTO_IPV6, libc::IPV6_TCLASS) => unsafe {
cmsg::decode::<libc::c_int>(cmsg) as u8
// Temporary hack around broken macos ABI. Remove once upstream fixes it.
// https://bugreport.apple.com/web/?problemID=48761855
if cfg!(target_os = "macos")
&& cmsg.cmsg_len as usize
== libc::CMSG_LEN(mem::size_of::<u8>() as _) as usize
{
cmsg::decode::<u8>(cmsg)
} else {
cmsg::decode::<libc::c_int>(cmsg) as u8
}
},
_ => 0,
},