By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,276 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,276 IT Pros & Developers. It's quick & easy.

Calculating CheckSum for Raw UDP packet

P: n/a
I'm trying to calculate the checksum for UDP packet. The algorithm itself
is not difficult (lots of examples out there), but what I'm having the most
trouble with is determining the byte order that multibyte values need to be
in. The RFC's for the IP header and UDP protocol do not specify whether the
multibyte values need to be stored in host or network byte order.

Also, the verbage of the description for constructing the pseudoheader used
to calculate the UDP checksum is a bit confusing.

First the IP header. Do "length" and "header checksum" need to be stored in
the IP header in network or host order?

Second, the pseudo UDP header for calculating checksum as specified by RFC
768 (http://www.faqs.org/rfcs/rfc768.html). The way I interpret this is to
take the specified fields from the IP header, to construct a pseudo header.
Then, attach the UDP packet (source and dest port, size, checksum and data)
to the end of this pseudo header and use this entire block to calculate the
checksum. But, one of the fields in the pseudo header is "UDP length". Is
this length the same as the length used in the IP header or the length of
the "pseudo header" and UDP header and data?

After checksums are calculated, are they supposed to be stored in network or
host byte order?

Thanks,
Terry
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Nevermind. I got this figured out. "C# Network Programming" by Richard
Blum is an awesome book! I love it. :-)
"Terry" <ch**********@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP09.phx.gbl...
I'm trying to calculate the checksum for UDP packet. The algorithm itself
is not difficult (lots of examples out there), but what I'm having the most trouble with is determining the byte order that multibyte values need to be in. The RFC's for the IP header and UDP protocol do not specify whether the multibyte values need to be stored in host or network byte order.

Also, the verbage of the description for constructing the pseudoheader used to calculate the UDP checksum is a bit confusing.

First the IP header. Do "length" and "header checksum" need to be stored in the IP header in network or host order?

Second, the pseudo UDP header for calculating checksum as specified by RFC
768 (http://www.faqs.org/rfcs/rfc768.html). The way I interpret this is to take the specified fields from the IP header, to construct a pseudo header. Then, attach the UDP packet (source and dest port, size, checksum and data) to the end of this pseudo header and use this entire block to calculate the checksum. But, one of the fields in the pseudo header is "UDP length". Is this length the same as the length used in the IP header or the length of
the "pseudo header" and UDP header and data?

After checksums are calculated, are they supposed to be stored in network or host byte order?

Thanks,
Terry

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.