From f55dbaf8d04f82e6ef46c82fa5cc1380604fc2e1 Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Tue, 16 Apr 2019 07:42:45 -0700 Subject: [PATCH] Hack around broken macOS ECN ABI --- quinn/src/platform/unix.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/quinn/src/platform/unix.rs b/quinn/src/platform/unix.rs index 4fb1d1907..4de447d2f 100644 --- a/quinn/src/platform/unix.rs +++ b/quinn/src/platform/unix.rs @@ -158,7 +158,16 @@ impl super::UdpExt for UdpSocket { cmsg::decode::(cmsg) }, (libc::IPPROTO_IPV6, libc::IPV6_TCLASS) => unsafe { - cmsg::decode::(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::() as _) as usize + { + cmsg::decode::(cmsg) + } else { + cmsg::decode::(cmsg) as u8 + } }, _ => 0, },