diff options
author | peter <peter@FreeBSD.org> | 2002-06-29 09:00:47 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-06-29 09:00:47 +0000 |
commit | 151c32fd6dbf480b69a082de33ddd6a3620f0ace (patch) | |
tree | 8d3db102be852b77298b73b96719296dd2647bc0 /lib/libstand | |
parent | 5322498852d694f03276468c64386d3ebc23a19c (diff) | |
download | FreeBSD-src-151c32fd6dbf480b69a082de33ddd6a3620f0ace.zip FreeBSD-src-151c32fd6dbf480b69a082de33ddd6a3620f0ace.tar.gz |
Update from NetBSD 1.3 -> 1.6. Most notable, rev 1.6:
"Make in_cksum work on little endian machines"
This would explain a few things. :-)
Diffstat (limited to 'lib/libstand')
-rw-r--r-- | lib/libstand/in_cksum.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/libstand/in_cksum.c b/lib/libstand/in_cksum.c index 1fc7344..e253fad 100644 --- a/lib/libstand/in_cksum.c +++ b/lib/libstand/in_cksum.c @@ -1,4 +1,4 @@ -/* $NetBSD: in_cksum.c,v 1.3 1995/04/22 13:53:48 cgd Exp $ */ +/* $NetBSD: in_cksum.c,v 1.6 2000/03/31 19:55:09 castor Exp $ */ /* * Copyright (c) 1992 Regents of the University of California. @@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> +#include <machine/endian.h> + +#include "stand.h" /* * Checksum routine for Internet Protocol family headers. @@ -71,12 +74,21 @@ in_cksum(p, len) } } else { while ((len -= 2) >= 0) { +#if BYTE_ORDER == BIG_ENDIAN sum += *cp++ << 8; sum += *cp++; +#else + sum += *cp++; + sum += *cp++ << 8; +#endif } } if ((oddbyte = len & 1) != 0) +#if BYTE_ORDER == BIG_ENDIAN v = *cp << 8; +#else + v = *cp; +#endif } if (oddbyte) sum += v; |