Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

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.

share|improve this answer
    
Why does a pseudoheader even have to be created? Why not just use the header and the data? –  Wintermute Mar 8 '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 8 '11 at 23:24

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.

share|improve this answer
    
What other protocols violate the independence of layers? –  Wintermute Mar 9 '11 at 3:25

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.