|
|||||||||||
|
Re: FW: [Q] cksum of UDP packet
From: crawford charles <biv0uac17(at)hotmail.com>
Date: Wed Jul 30 2003 - 11:22:32 EDT
I hope that this helps.
From: Qin An [mailto:anqin@anqin.com]
Hi, Glad to meet you all!
I got a problem in cksum computation for UDP packet. At the end of this
mail, there is
0x07, 0x2c, 0x00, 0x35, 0x00, 0x0c, 0x98, 0x8e, 0x64, 0x69, 0x72, 0x0a
The 6th and 7th element is the cksum computed by the sender's kernel. My
question is that
Thank you in advance! Qin An unsigned short in_cksum (unsigned short *ptr, int nbytes) { unsigned long sum; /* assumes long == 32 bits */ unsigned short oddbyte, answer; /* assumes short == 16 bits */
sum = 0;
/* mop up an odd byte, if necessary */
/* add back carry outs from top 16 bits to low 16 bits */
unsigned char s[] = {
int main (int argc, char *argv[])
int i; s[6] = s[7] = 0; i = in_cksum ((unsigned short *) &s[0], 12); } Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail Received on Wed Jul 30 16:34:35 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:46 EDT |
||||||||||
|
|||||||||||