Take the 2-minute tour ×  The UDP header struct defined at
/usr/include/netinet/udp.h is as follows  struct udphdr
u_int16_t source;   u_int16_t dest;   u_int16_t len;   u_int16_t
check;  What value is stored in the check field of the header?
How to verify if the checksum is correct? I meant on what data
is the checksum computed? (Is it just the udp header or udp
header plus the payload that follows it?)   share|improve this
question add comment  2 Answers  up vote 19 down vote accepted
The UDP checksum is performed over the entire payload, and the
other fields in the header, and some fields from the IP header.
A pseudo-header is constructed from the IP header in order to
perform the calculation (which is done over this pseudo-header,
the UDP header and the payload). The reason the pseudo-header is
included is to catch packets that have been routed to the wrong
IP address.  Basically, at the receiving end, all the 16-bit
words of the headers plus data area are added together (wrapping
at 16 bits) and the r