Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECN on Windows #765

Closed
Demi-Marie opened this issue May 11, 2020 · 15 comments
Closed

ECN on Windows #765

Demi-Marie opened this issue May 11, 2020 · 15 comments

Comments

@Demi-Marie
Copy link
Contributor

This might be possible, although the APIs are undocumented.

@Ralith
Copy link
Collaborator

Ralith commented May 11, 2020

It would be useful to cite evidence.

@Demi-Marie
Copy link
Contributor Author

Receiving ECN is possible via the IP_RECVTOS option at IPPROTO_IP and the IPV6_RECVTCLASS option at IPPROTO_IPV6. Setting is definitely possible if one has administrative privileges. I am not sure about otherwise.

@Demi-Marie
Copy link
Contributor Author

Setting it might be possible via the undocumented IPV6_ECN and IP_ECN socket options.

@Demi-Marie
Copy link
Contributor Author

As per microsoft/msquic#559 (comment) I don’t believe this is supported on current versions of Windows. Closing.

@Demi-Marie
Copy link
Contributor Author

Reopening in light of microsoft/msquic#559 (comment) which actually implements ECN in MsQuic. Since msquic.dll is not an OS-provided DLL, I am confident that this will continue to work in future releases of Windows.

@Demi-Marie Demi-Marie reopened this Aug 26, 2020
@panxy2013
Copy link

in microsoft document, we can write UDP client / server, and use wirshark can find, IP ECN 2bits can be modify by windows socket API WSASendMsg

but how to use in Rust, does quinn-udp can support such action?

  1. send UDP with ECN bit = 0x01 or 0x02
  2. Recieve UDP and can get ECN bit from receive UDP packet

https://learn.microsoft.com/en-us/windows/win32/winsock/winsock-ecn

Thanks

@djc
Copy link
Member

djc commented Jul 23, 2023

We don't support this yet in quinn-udp, would you be able to send a PR to use windows-sys APIs to implement this?

@panxy2013
Copy link

Well, since I'm newer to Rust, I don't have the ability to write good Rust code at the moment
i am working with ALVR project, which use C++/Rust language.

i will use workaround to solve the current problem(Rust call C API to send ECN UDP packet)
Maybe i can try it, Thank you for your explanation

@stormshield-damiend
Copy link
Contributor

I did a quick study about this support and i think it is doable, i will work on this and submit a PR when done.

@stormshield-damiend
Copy link
Contributor

stormshield-damiend commented Oct 30, 2023

Little update in teaser mode :

  • i now detect the WSARecvMsg function pointer using a dedicated WSAIoctl call as this function is an extension of the network stack
  • i have modified recv() and send() function to use socket2 sendmsg() and WSARecvMsg function if detected, if not i fallback to the previous version of the code
  • perf client and server still work with the new code
  • i am now looking at how to encode and decode control message to enable and use PKTINFO and also ECN

@Ralith
Copy link
Collaborator

Ralith commented Oct 30, 2023

use socket2 sendmsg() and WSARecvMsg function if detected, if not i fallback to the previous version of the code

Out of curiosity, when do we expect this to fail?

@stormshield-damiend
Copy link
Contributor

use socket2 sendmsg() and WSARecvMsg function if detected, if not i fallback to the previous version of the code

Out of curiosity, when do we expect this to fail?

From what i read, this function was introduced with TCP/IP version 6 extension on Windows XP, what is strange is that nowadays you still need to detect it dynamically event if it seems supported by default since Windows 8.1.

@Ralith
Copy link
Collaborator

Ralith commented Nov 2, 2023

Huh, that is funny. I'm not sure it's worth the maintenance trouble to maintain a fallback for such old versions of Windows, in any case.

@stormshield-damiend
Copy link
Contributor

Little update :

  • new code support ECN and IN[6]_PKTINFO using WSARecvMsg / WSASendMsg and a new wsa_cmsg.rs
  • perf client and server work with the new code
  • performance seem to be in the same order of magnitude
  • tests are currently broken due to new PKTINFO support (i am working on them at the moment)

I plan to send a draft PR as soon as possible

@djc
Copy link
Member

djc commented Jan 5, 2024

Fixed in #1701.

@djc djc closed this as completed Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants