IPv4 UDP – Why UDP Checksum is Optional

checksumip addressipv4layer4udp

We know that IPv4 header has checksum for header not for data .Therefore for checking data error we need checksum in transport layer. Suppose we're using UDP in layer 4. So if I remove the checksum option from UDP datagram how error will be detected? Or My question is why UDP checksum is optional for IPv4?

Best Answer

That's just the way it is designed. You can use a checksum but you don't need to.

The application might not care so much about data corruption or your application-layer protocol might include a much better integrity check than UDP's very simple checksum. Also, there may be scenarios where it is preferrable to receive anything rather than nothing at all.

Using no checksum in the UDP header can also be a benefit - since datagrams failing checksum verification are simply dropped, the receiving application doesn't get to see them.

By explicitly not using the checksum option, the sender application can have damaged datagrams delivered to the receiver application just the same. Now, if the sender application also includes forward error correction (FEC) information in the UDP payload (on the application layer), that allows the receiver application to repair damaged data and receive correct data after all.