mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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. :-)
This commit is contained in:
parent
f04af82768
commit
08db6efa75
1 changed files with 13 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue