Path: utzoo!attcan!uunet!ginosko!uakari.primate.wisc.edu!nic.MR.NET!hal!ncoast!sgtech!adnan From: adnan@sgtech.UUCP (Adnan Yaqub) Newsgroups: comp.protocols.tcp-ip Subject: Checksum Byte Order...What is it? Message-ID:Date: 27 Sep 89 09:12:03 GMT Sender: adnan@sgtech.UUCP Distribution: na Organization: Star Gate Technologies, Inc. Lines: 26 I have a question about the byte order of TCP/IP checksums. I was looking through the Berkeley code, and it seems to me that the byte order of the checksum is not adjusted for depending on the "endianish" of the host. For example, I see the following code: ip->ip_len = htons((u_short)ip->ip_len); ip->ip_off = htons((u_short)ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(m, hlen); error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst); Since the checksum is a 16-bit quantity, it would see to me that one would get a different value depending on whether the host is big or little endian. I looked at in_cksum_c (I don't have a copy of in_cksum), and it doesn't seem to be endian sensitive. (I may be wrong, because the code is quite tricky.) On the experimental side, I wrote some code to send out UDP datagram with the checksum passed through htons. The result was that the receiving host (an Excelan network analyzer) said the checksum was wrong. I sent XXYY and it wanted YYXX. So, how should the checksum be sent? -- Adnan Yaqub Star Gate Technologies, 29300 Aurora Rd., Solon, OH, USA, +1 216 349 1860 ...cwjcc!ncoast!sgtech!adnan ...uunet!abvax!sgtech!adnan