Skip to content

Commit

Permalink
fix(udp/windows): set socket option IPV6_RECVECN
Browse files Browse the repository at this point in the history
On Windows, to enable ECN reporting, one sets the `IPV6_RECVECN` socket option.
The Windows IP stack will then report ECN markings via the `IPV6_ECN` message
type.

Previously `quinn-udp` would use `IPV6_ECN` for both. With this commit
`IPV6_RECVECN` is used to set the socket option and `IPV6_ECN` is used to read
the option.

Given that both constants evaluate to the same value (i.e. `50`) the previous
behavior does not result in an actual bug.

See also:

- https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
- https://www.ietf.org/archive/id/draft-duke-tsvwg-udp-ecn-01.html
- https://docs.rs/windows-sys/latest/windows_sys/Win32/Networking/WinSock/constant.IPV6_RECVECN.html
- https://docs.rs/windows-sys/latest/windows_sys/Win32/Networking/WinSock/constant.IPV6_ECN.html
  • Loading branch information
mxinden authored and Ralith committed Jan 5, 2025
1 parent f5b1ec7 commit c32e2e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion quinn-udp/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl UdpSocketState {
set_socket_option(
&*socket.0,
WinSock::IPPROTO_IPV6,
WinSock::IPV6_ECN,
WinSock::IPV6_RECVECN,
OPTION_ON,
)?;
}
Expand Down

0 comments on commit c32e2e2

Please sign in to comment.