changeset 257:c93a1887a50f

Fix problems on big endian systems.
author gthomas
date Wed, 31 Jul 2002 14:02:18 +0000
parents 1eb79d208648
children c87a23e09a9a
files packages/net/bsd_tcpip/current/ChangeLog packages/net/bsd_tcpip/current/src/sys/netinet/in_cksum.c
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/net/bsd_tcpip/current/ChangeLog
+++ b/packages/net/bsd_tcpip/current/ChangeLog
@@ -1,3 +1,7 @@
+2002-07-31  Gary Thomas  <gary@chez-thomas.org>
+
+	* src/sys/netinet/in_cksum.c: Fix problem on big endian machines.
+
 2002-07-26  Gary Thomas  <gary@chez-thomas.org>
 2002-07-26  Ken Cox <jkc@redhat.com>
 
--- a/packages/net/bsd_tcpip/current/src/sys/netinet/in_cksum.c
+++ b/packages/net/bsd_tcpip/current/src/sys/netinet/in_cksum.c
@@ -88,11 +88,19 @@
     }
 
 static const u_int32_t in_masks[] = {
+#if BYTE_ORDER == BIG_ENDIAN
+	/*0 bytes*/ /*1 byte*/	/*2 bytes*/ /*3 bytes*/
+	0x00000000, 0xFF000000, 0xFFFF0000, 0xFFFFFF00,	/* offset 0 */
+	0x00000000, 0x00FF0000, 0x00FFFF00, 0x00FFFFFF,	/* offset 1 */
+	0x00000000, 0x0000FF00, 0x0000FFFF, 0x0000FFFF,	/* offset 2 */
+	0x00000000, 0x000000FF, 0x000000FF, 0x000000FF,	/* offset 3 */
+#else
 	/*0 bytes*/ /*1 byte*/	/*2 bytes*/ /*3 bytes*/
 	0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF,	/* offset 0 */
 	0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00,	/* offset 1 */
 	0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000,	/* offset 2 */
 	0x00000000, 0xFF000000, 0xFF000000, 0xFF000000,	/* offset 3 */
+#endif
 };
 
 union l_util {