What can cause IP header checksums to not be calculated for UDP datagrams?
Asked Answered
A

2

5

I am trying to send UDP datagrams from a UdpClient on Windows XP to a device, but it is not responding. When I look at that traffic in Wireshark, I see that my outbound packets are bad, because all of their IP header checksums are 0x0000.

The machine has two network cards, so I started using the other network card and started experiencing the same issue.

I can ping my device with both network cards just fine, so I assume there must be something that my C# code is doing wrong, but I am not sure what. Is there something you can do wrong in .NET 4 on Windows XP with a UdpClient to cause this?

Aimo answered 11/7, 2012 at 13:39 Comment(0)
N
8

You're seeing an empty checksum because Windows is performing hardware offloading of the checksum calculation. It will be performed by the network interface card's (NIC) processor. Capturing a packet using a packet sniffer will show the packet before it has been processed by your NIC. You can turn off offloading from the device's properties page under Device Manager:

enter image description here enter image description here

In any case, the UDP protocol defines the checksum as optional, and zero is a valid value for the checksum. This is to allow devices with low processing power to skip the checksum calculation. The checksum will usually be filled-in by the first network node that processes the packet (e.g. router). Even if it remains zero, your device should still accept the packet as it's valid.

EDIT: I've just realized that you're talking about the IP header, not the UPD header. This applies to both, except that the IP header checksum is not optional (and will be calculated by your NIC).

Nmr answered 11/7, 2012 at 13:46 Comment(2)
I guess I'll choose the answer that has pictures.Aimo
If I disable TCP Checksum Offload or UDP Checksum Offload, Wireshark shows a checksum validation failure. It works for me after only disable IPv4 Checksum Offload in the Advanced tab in above picture. I'm using Windows 10 build 18363.1139.Briannebriano
T
4

Looks like a driver issue. Try turning off checksum offload in the driver properties.

Alternatively, if you are running wireshark on the same machine, it may be that checksum offload is working correctly and Wireshark is not reporting the checksum because it is being calculated after Wireshark sees the packet.

To confirm run wireshark on a separate box to confirm the checksum is zero or is not zero.

If the checksums are OK after all, then it is likely a firewall issue. Make sure you have a firewall rule on the local machine permitting the return traffic.

Torus answered 11/7, 2012 at 13:42 Comment(1)
@john, Thanks, which one was correct - firewall or driver issue?Torus

© 2022 - 2024 — McMap. All rights reserved.