swi-prolog: update to 9.2.9
[oi-userland.git] / components / web / firefox / patches / 10-quinn-udp-illumos-support.patch
blob3842341ef0d94d9f70c3958cee295e386956e4a3
1 quinn-udp needs illumos/illumos support. Firefox uses this for the new
2 http/2 code.
3 --- gecko-dev-fa55b33a4b56f392bc5a0c7616e0dfe055112cb5/third_party/rust/quinn-udp/.cargo-checksum.json.old 2024-07-27 12:06:31.655202997 -0400
4 +++ gecko-dev-fa55b33a4b56f392bc5a0c7616e0dfe055112cb5/third_party/rust/quinn-udp/.cargo-checksum.json 2024-07-27 12:06:59.594477839 -0400
5 @@ -1 +1 @@
6 -{"files":{"Cargo.toml":"bf505df0c4f9254fa37950bad863cb838a8a7d2be4c8d3f28bdd679f945ef8cf","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"4b2d0aca6789fa39e03d6738e869ea0988cceba210ca34ebb59c15c463e93a04","benches/throughput.rs":"8f00856e6c6f1dd8c7dd6c8a22b36c6f42dfa4d709edf3348de75d32e22c71fb","src/cmsg/mod.rs":"23d898d72c5aabda93d987526fdd78231bb5907bce2b6b2d292a56bdfd977f86","src/cmsg/unix.rs":"1a4089e5e61536a3c370c6b1bc891036ec2d0e2e78105fbb5b8227705e905d34","src/cmsg/windows.rs":"6fb936ec4a283efc5796872e777441e3039c40589073865644a8ef7936af4f4b","src/fallback.rs":"7fe9666b0bf508d1b5ec0b3690bb7add94c8f213cb51a263c9959e22a5094ad0","src/lib.rs":"72be7f797a3a11e452e7764fadadebc43ae7f9c14ba7fa80aedbbee71aa889c7","src/unix.rs":"fbc9a6ab281cc66500e6afa8b9ebdee73ca281ca14732e8076d9b1f10f431de7","src/windows.rs":"e741a7bdd86d7fcb856db855f9308af01e69387c00e6a726d322f1f4d3046b74","tests/tests.rs":"51bcf6d3f1a3fcf7d481ae966eb679f88341886ff4277f5747df3340ed709d09"},"package":"8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285"}
7 \ No newline at end of file
8 +{"files":{"Cargo.toml":"bf505df0c4f9254fa37950bad863cb838a8a7d2be4c8d3f28bdd679f945ef8cf","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"4b2d0aca6789fa39e03d6738e869ea0988cceba210ca34ebb59c15c463e93a04","benches/throughput.rs":"8f00856e6c6f1dd8c7dd6c8a22b36c6f42dfa4d709edf3348de75d32e22c71fb","src/cmsg/mod.rs":"23d898d72c5aabda93d987526fdd78231bb5907bce2b6b2d292a56bdfd977f86","src/cmsg/unix.rs":"1a4089e5e61536a3c370c6b1bc891036ec2d0e2e78105fbb5b8227705e905d34","src/cmsg/windows.rs":"6fb936ec4a283efc5796872e777441e3039c40589073865644a8ef7936af4f4b","src/fallback.rs":"7fe9666b0bf508d1b5ec0b3690bb7add94c8f213cb51a263c9959e22a5094ad0","src/lib.rs":"72be7f797a3a11e452e7764fadadebc43ae7f9c14ba7fa80aedbbee71aa889c7","src/unix.rs":"9417f7d5c8b1019a21d4aabf9bbbcad343ab66c1de4d20f4379efe515a37d1ea","src/windows.rs":"e741a7bdd86d7fcb856db855f9308af01e69387c00e6a726d322f1f4d3046b74","tests/tests.rs":"51bcf6d3f1a3fcf7d481ae966eb679f88341886ff4277f5747df3340ed709d09"},"package":"8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285"}
10 --- gecko-dev-fa55b33a4b56f392bc5a0c7616e0dfe055112cb5/third_party/rust/quinn-udp/src/unix.rs.~1~ 2024-07-26 11:08:57.000000000 -0400
11 +++ gecko-dev-fa55b33a4b56f392bc5a0c7616e0dfe055112cb5/third_party/rust/quinn-udp/src/unix.rs 2024-07-28 22:01:23.213328142 -0400
12 @@ -1,4 +1,4 @@
13 -#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "openbsd")))]
14 +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "openbsd", target_os = "illumos")))]
15 use std::ptr;
16 use std::{
17 io::{self, IoSliceMut},
18 @@ -25,11 +25,31 @@
19 // Defined in netinet6/in6.h on OpenBSD, this is not yet exported by the libc crate
20 // directly. See https://github.com/rust-lang/libc/issues/3704 for when we might be able to
21 // rely on this from the libc crate.
22 -#[cfg(any(target_os = "openbsd", target_os = "netbsd"))]
23 +#[cfg(any(target_os = "openbsd", target_os = "netbsd", target_os = "illumos"))]
24 const IPV6_DONTFRAG: libc::c_int = 62;
25 -#[cfg(not(any(target_os = "openbsd", target_os = "netbsd")))]
26 +#[cfg(not(any(target_os = "openbsd", target_os = "netbsd", target_os = "illumos")))]
27 const IPV6_DONTFRAG: libc::c_int = libc::IPV6_DONTFRAG;
29 +// Add missing IP constants from /usr/include/netinet/in.h for illumos
30 +#[cfg(any(target_os = "illumos"))]
31 +const IPV6_RECVTCLASS: libc::c_int = 25;
33 +#[cfg(any(target_os = "illumos"))]
34 +const IP_TOS: libc::c_int = 3;
36 +#[cfg(any(target_os = "illumos"))]
37 +const IPV6_TCLASS: libc::c_int = 38;
39 +#[cfg(any(target_os = "illumos"))]
40 +#[derive(Copy, Clone)]
41 +struct in6_pktinfo {
42 + ipi6_addr: libc::in6_addr,
43 + ipi6_ifindex: libc::c_uint,
46 +#[cfg(any(target_os = "illumos"))]
47 +const IPV6_PKTINFO: libc::c_int = 11;
49 #[cfg(target_os = "freebsd")]
50 type IpTosTy = libc::c_uchar;
51 #[cfg(not(any(target_os = "freebsd", target_os = "netbsd")))]
52 @@ -67,7 +87,7 @@
53 || cfg!(target_os = "android")
55 cmsg_platform_space +=
56 - unsafe { libc::CMSG_SPACE(mem::size_of::<libc::in6_pktinfo>() as _) as usize };
57 + 0;
60 assert!(
61 @@ -87,7 +107,7 @@
63 // mac and ios do not support IP_RECVTOS on dual-stack sockets :(
64 // older macos versions also don't have the flag and will error out if we don't ignore it
65 - #[cfg(not(any(target_os = "openbsd", target_os = "netbsd")))]
66 + #[cfg(not(any(target_os = "openbsd", target_os = "netbsd", target_os = "illumos")))]
67 if is_ipv4 || !io.only_v6()? {
68 #[allow(unused_variables)]
69 if let Err(err) = set_socket_option(&*io, libc::IPPROTO_IP, libc::IP_RECVTOS, OPTION_ON)
70 @@ -142,10 +162,11 @@
71 target_os = "openbsd",
72 target_os = "netbsd",
73 target_os = "macos",
74 - target_os = "ios"
75 + target_os = "ios",
76 + target_os = "illumos"
77 ))]
78 // IP_RECVDSTADDR == IP_SENDSRCADDR on FreeBSD
79 - // macOS uses only IP_RECVDSTADDR, no IP_SENDSRCADDR on macOS
80 + // macOS uses only IP_RECVDSTADDR, no IP_SENDSRCADDR on macOS/Illumos
81 // macOS also supports IP_PKTINFO
83 if is_ipv4 {
84 @@ -156,7 +177,7 @@
85 // Options standardized in RFC 3542
86 if !is_ipv4 {
87 set_socket_option(&*io, libc::IPPROTO_IPV6, libc::IPV6_RECVPKTINFO, OPTION_ON)?;
88 - set_socket_option(&*io, libc::IPPROTO_IPV6, libc::IPV6_RECVTCLASS, OPTION_ON)?;
89 + set_socket_option(&*io, libc::IPPROTO_IPV6,IPV6_RECVTCLASS, OPTION_ON)?;
90 // Linux's IP_PMTUDISC_PROBE allows us to operate under interface MTU rather than the
91 // kernel's path MTU guess, but actually disabling fragmentation requires this too. See
92 // __ip6_append_data in ip6_output.c.
93 @@ -372,7 +393,7 @@
94 Ok(())
97 -#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "openbsd")))]
98 +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "openbsd", target_os = "illumos")))]
99 fn recv(io: SockRef<'_>, bufs: &mut [IoSliceMut<'_>], meta: &mut [RecvMeta]) -> io::Result<usize> {
100 let mut names = [MaybeUninit::<libc::sockaddr_storage>::uninit(); BATCH_SIZE];
101 let mut ctrls = [cmsg::Aligned(MaybeUninit::<[u8; CMSG_LEN]>::uninit()); BATCH_SIZE];
102 @@ -409,7 +430,7 @@
103 Ok(msg_count as usize)
106 -#[cfg(any(target_os = "macos", target_os = "ios", target_os = "openbsd"))]
107 +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "openbsd", target_os = "illumos"))]
108 fn recv(io: SockRef<'_>, bufs: &mut [IoSliceMut<'_>], meta: &mut [RecvMeta]) -> io::Result<usize> {
109 let mut name = MaybeUninit::<libc::sockaddr_storage>::uninit();
110 let mut ctrl = cmsg::Aligned(MaybeUninit::<[u8; CMSG_LEN]>::uninit());
111 @@ -438,7 +459,7 @@
113 /// It uses [`libc::syscall`] instead of [`libc::recvmmsg`]
114 /// to avoid linking error on systems where libc does not contain `recvmmsg`.
115 -#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "openbsd")))]
116 +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "openbsd", target_os = "illumos")))]
117 unsafe fn recvmmsg_with_fallback(
118 sockfd: libc::c_int,
119 msgvec: *mut libc::mmsghdr,
120 @@ -481,7 +502,7 @@
121 /// Fallback implementation of `recvmmsg` using `recvmsg`
122 /// for systems which do not support `recvmmsg`
123 /// such as Linux <2.6.33.
124 -#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "openbsd")))]
125 +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "openbsd", target_os = "illumos")))]
126 unsafe fn recvmmsg_fallback(
127 sockfd: libc::c_int,
128 msgvec: *mut libc::mmsghdr,
129 @@ -541,11 +562,11 @@
130 if !sendmsg_einval {
131 #[cfg(not(target_os = "netbsd"))]
133 - encoder.push(libc::IPPROTO_IP, libc::IP_TOS, ecn as IpTosTy);
134 + encoder.push(libc::IPPROTO_IP, IP_TOS, ecn as IpTosTy);
137 } else {
138 - encoder.push(libc::IPPROTO_IPV6, libc::IPV6_TCLASS, ecn);
139 + encoder.push(libc::IPPROTO_IPV6, IPV6_TCLASS, ecn);
142 if let Some(segment_size) = transmit.segment_size {
143 @@ -572,6 +593,7 @@
144 target_os = "netbsd",
145 target_os = "macos",
146 target_os = "ios",
147 + target_os = "illumos",
150 if encode_src_ip {
151 @@ -583,13 +605,13 @@
154 IpAddr::V6(v6) => {
155 - let pktinfo = libc::in6_pktinfo {
156 + let pktinfo = in6_pktinfo {
157 ipi6_ifindex: 0,
158 ipi6_addr: libc::in6_addr {
159 s6_addr: v6.octets(),
162 - encoder.push(libc::IPPROTO_IPV6, libc::IPV6_PKTINFO, pktinfo);
163 + encoder.push(libc::IPPROTO_IPV6, IPV6_PKTINFO, pktinfo);
167 @@ -626,15 +648,15 @@
168 let cmsg_iter = unsafe { cmsg::Iter::new(hdr) };
169 for cmsg in cmsg_iter {
170 match (cmsg.cmsg_level, cmsg.cmsg_type) {
171 - (libc::IPPROTO_IP, libc::IP_TOS) => unsafe {
172 + (libc::IPPROTO_IP, IP_TOS) => unsafe {
173 ecn_bits = cmsg::decode::<u8, libc::cmsghdr>(cmsg);
175 // FreeBSD uses IP_RECVTOS here, and we can be liberal because cmsgs are opt-in.
176 - #[cfg(not(any(target_os = "openbsd", target_os = "netbsd")))]
177 + #[cfg(not(any(target_os = "openbsd", target_os = "netbsd", target_os = "illumos")))]
178 (libc::IPPROTO_IP, libc::IP_RECVTOS) => unsafe {
179 ecn_bits = cmsg::decode::<u8, libc::cmsghdr>(cmsg);
181 - (libc::IPPROTO_IPV6, libc::IPV6_TCLASS) => unsafe {
182 + (libc::IPPROTO_IPV6, IPV6_TCLASS) => unsafe {
183 // Temporary hack around broken macos ABI. Remove once upstream fixes it.
184 // https://bugreport.apple.com/web/?problemID=48761855
185 #[allow(clippy::unnecessary_cast)] // cmsg.cmsg_len defined as size_t
186 @@ -664,8 +686,8 @@
187 let in_addr = unsafe { cmsg::decode::<libc::in_addr, libc::cmsghdr>(cmsg) };
188 dst_ip = Some(IpAddr::V4(Ipv4Addr::from(in_addr.s_addr.to_ne_bytes())));
190 - (libc::IPPROTO_IPV6, libc::IPV6_PKTINFO) => {
191 - let pktinfo = unsafe { cmsg::decode::<libc::in6_pktinfo, libc::cmsghdr>(cmsg) };
192 + (libc::IPPROTO_IPV6, IPV6_PKTINFO) => {
193 + let pktinfo = unsafe { cmsg::decode::<in6_pktinfo, libc::cmsghdr>(cmsg) };
194 dst_ip = Some(IpAddr::V6(Ipv6Addr::from(pktinfo.ipi6_addr.s6_addr)));
196 #[cfg(target_os = "linux")]