简体   繁体   中英

Unable to send UDP packets larger than the MTU with Windows Build 1809 using C# UdpClient

Short version of below - we can't seem to successfully send UDP packets larger than 1472 bytes when running Build 1809 of Windows, though it worked OK in previous versions.

We have an existing C# application (really a set of applications) that runs on a local wired network that periodically sends out UDP packets to communicate status to other applications on different computers on the network. Some of these packets are small, but some are fairly large, up close to the limit of 64k for UDP. This application is written in C# using .NET 4.5.1 and uses the UdpClient class to broadcast and receive broadcasts. Prior to testing with Windows 10 build 1809 / Windows Server 2019 build 1809, everything worked fine - we sent and received the larger packets without a problem. However, starting with build 1809, it appears that we can no longer successfully send the large packets. Here is some of the testing that we did:

System 1: Windows 10 Build 1803 (MTU is 1500)

System 2: Windows 10 Build 1809 (MTU is 1500)

I wrote a test program that sends out a small (200 bytes or so) and large (8000 bytes or so) UDP packet using UdpClient, while also listening for those packets. Here is what happens when I send from each system:

-Send from System 1:

-System 1 sees both packets

-System 2 sees both packets

-Send from System 2:

 -System 1 sees only the small packet

 -System 2 sees both packets

This happens every single time - the large packets never arrive successfully. Further testing revealed that the magic number was 1472 bytes. That or less worked, and more than that failed. This is why I suspect that something with fragmenting/MTU is not working correctly. We had not seen this problem before, so I fired up Wireshark to take a look at what might be going on. However, and this is where it gets weird, starting Wireshark on the Build 1809 system suddenly makes it able to send the packet, even if I exit Wireshark. Rebooting the system, though, reverts it to its original state of being unable to send successfully. I should note that I always see "Fragmented IP Protocol" for these packets in Wireshark on the receiving end of things regardless of whether they are working correctly or not.

I did some reading online and found that RDP over UDP had a major overhaul in Build 1809, but I did not see anything about UDP packets larger than the MTU having a problem, nor was I able to find anyone else reporting this particular issue.

We have made no code changes to this part of our code in a long time - it worked on Windows 7, Server 2012R2, Server 2016, and Windows 10 prior to build 1809. Is there something new in Build 1809 that requires us to set a flag somewhere or configure something on the network adapter? I don't know what all Wireshark does when it boots up, but it seems to "fix" things somehow, so if anyone has an idea what that might be specifically that could help as well.

I ended up contacting Microsoft about this early last year and pushed until they admitted it was an issue. The issue affects 1809, 1903, 1909, 2004, and 20H2. They have finally released the fix publicly in the "2021-03 Cumulative Update for Windows 10". Fixes are available for 1903 and higher. I have confirmed this update does indeed fix the issue for us.

See: https://www.catalog.update.microsoft.com/Search.aspx?q=KB5001649

It is not mentioned specifically in this KB anywhere that I can find, but this is the version the support person gave me and it is fixed after applying this update.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM