diff --git a/rs/moq-quic/README.md b/rs/moq-quic/README.md index c70be9044ca..a61c8dd2503 100644 --- a/rs/moq-quic/README.md +++ b/rs/moq-quic/README.md @@ -17,6 +17,7 @@ Cherry-picked since the fork point: - [`ecc0dcfd`](https://github.com/quinn-rs/quinn/commit/ecc0dcfdeaec996d276da31d836f965753b66ea4): truncate an application `CONNECTION_CLOSE` reason by the error code's actual width, so a four- or eight-byte code no longer overruns the frame's budget. - [`0365181f`](https://github.com/quinn-rs/quinn/commit/0365181f2d1ee63606d43b6e858c4f70c5802c08) (moq-tokio's `quic::driver`): an ignored `ECONNRESET` or `EMSGSIZE` receive error counts toward the receive work budget, so a flood of them cannot hold the endpoint task. - [`f74e6a8a`](https://github.com/quinn-rs/quinn/commit/f74e6a8a15e5aa980044b7fa03a31878c6a8c65c): check a DATAGRAM frame's encoded size against `max_datagram_frame_size`, and drop rather than refuse one whose queue metadata overflows the receive buffer, so a datagram of the advertised maximum size no longer closes the connection. +- [`17596dde`](https://github.com/quinn-rs/quinn/commit/17596ddefb09dae895129520824055d0ac8da5d5) (`moq_sock::udp`): on Windows, query `IPV6_V6ONLY` only on IPv6 sockets, so Winsock refusing the option on an IPv4 socket cannot fail endpoint creation. The fork never merges upstream. Upstream fixes are cherry-picked by hand, and the crate keeps quinn's formatting (rustfmt defaults) so the patches apply cleanly. diff --git a/rs/moq-sock/src/udp/windows.rs b/rs/moq-sock/src/udp/windows.rs index 6d5ac1e6c59..93eb068bbe7 100644 --- a/rs/moq-sock/src/udp/windows.rs +++ b/rs/moq-sock/src/udp/windows.rs @@ -60,10 +60,18 @@ impl UdpSocketState { }?; let family = info.iAddressFamily; let is_ipv6 = family == c_int::from(WinSock::AF_INET6); - let v6only = unsafe { - get_socket_option::(&*socket.0, WinSock::IPPROTO_IPV6, WinSock::IPV6_V6ONLY as _) - }?; - let is_ipv4 = family == c_int::from(WinSock::AF_INET) || v6only == 0; + let is_dual_stack = is_ipv6 && { + let v6_only = unsafe { + get_socket_option::( + &*socket.0, + WinSock::IPPROTO_IPV6, + WinSock::IPV6_V6ONLY as _, + ) + }?; + v6_only == 0 + }; + + let is_ipv4 = family == c_int::from(WinSock::AF_INET) || is_dual_stack; // We don't support old versions of Windows that do not enable access to `WSARecvMsg()` let wsa_recvmsg = resolve_wsa_recvmsg(&*socket.0).ok_or_else(|| {