0

Is it true that in the UDP header 2 bytes store a checksum for verification purposes by the destination host, and that this checksum is generated from a pseudoheader? If this is true, then why does a pseudoheader even have to be created? Why not just create a checksum from the other 6 bytes of the UDP header?

Wintermute
  • 355
  • 1
  • 5
  • 12

3 Answers3

1

Yes, the checksum is generated over the combination of the pseudo header and the UDP data. The psuedo header allows the UDP layer to double check whether the datagram has arrived at the correct address and been passed to the correct layer.

cbz
  • 213
  • 2
  • 6
  • Why does a pseudoheader even have to be created? Why not just use the header and the data? – Wintermute Mar 08 '11 at 20:55
  • 1
    The pseudo header includes the two IP addresses (source and destination) which provide an additional check that the packet actually came to the correct destination, and the protocol - which checks that the packet came to the correct layer 4. Remember, all these checksums are 16 bit rolling values, they'll only catch the simplest errors - so the multiple checksums of the same fields add an additional layer of robustness into the stack. – cbz Mar 08 '11 at 23:24
1

The pseudoheader is not "created" in the sense of going over the wire. The TCP/IP stack is violating independence of layers. UDP, a protocol at the transport layer, snooping into the IP header (internet layer) for the source and destination IP addresses and protocol.

However, I see your point: the IP header already contains a header checksum so why is information from IP header included in the UDP checksum? It may be an optimization but I suspect a TCP/IP stack would check both checksums.

Mark Wagner
  • 17,764
  • 2
  • 30
  • 47
1

This description behind the UDP checksum might be helpful.

It's mostly to provide and end-to-end check that the IP source/destination addresses and IP protocol info is correct. This can protect against mis-routed packets that somehow make it up to UDP. The downside is that it creates dependencies on the IP layer, and when you go through things like Network Address Translation, the UDP checksum also has to be modified.

Jeff
  • 360
  • 1
  • 2
  • 11