summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authoritojun <itojun@FreeBSD.org>2000-09-09 15:56:46 +0000
committeritojun <itojun@FreeBSD.org>2000-09-09 15:56:46 +0000
commitdd852005639d1ff167b73efb30c7fae56c23da90 (patch)
treed33da877b62da41bf2cd3b2ed5a9fd9b31405b18 /sys/netinet6
parent2676894951c4dbf401ae74922f77fcc75ba8c67c (diff)
downloadFreeBSD-src-dd852005639d1ff167b73efb30c7fae56c23da90.zip
FreeBSD-src-dd852005639d1ff167b73efb30c7fae56c23da90.tar.gz
add attrbute(packed) to union def with specific align constraitn.
move file static variable to auto variable, make in6_cksum() work better in kernel-MP environment. sync with kame. From: Alfred Perlstein <bright@wintelcom.net>
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6_cksum.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/netinet6/in6_cksum.c b/sys/netinet6/in6_cksum.c
index 1f26502..db564cf 100644
--- a/sys/netinet6/in6_cksum.c
+++ b/sys/netinet6/in6_cksum.c
@@ -1,5 +1,5 @@
/* $FreeBSD$ */
-/* $KAME: in6_cksum.c,v 1.6 2000/03/25 07:23:43 sumikawa Exp $ */
+/* $KAME: in6_cksum.c,v 1.9 2000/09/09 15:33:31 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -83,15 +83,6 @@
#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x)
#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);}
-static union {
- u_int16_t phs[4];
- struct {
- u_int32_t ph_len;
- u_int8_t ph_zero[3];
- u_int8_t ph_nxt;
- } ph;
-} uph;
-
/*
* m MUST contain a continuous IP6 header.
* off is a offset where TCP/UDP/ICMP6 header starts.
@@ -113,7 +104,14 @@ in6_cksum(m, nxt, off, len)
int srcifid = 0, dstifid = 0;
#endif
struct ip6_hdr *ip6;
-
+ union {
+ u_int16_t phs[4];
+ struct {
+ u_int32_t ph_len;
+ u_int8_t ph_zero[3];
+ u_int8_t ph_nxt;
+ } ph __attribute__((__packed__));
+ } uph;
union {
u_int8_t c[2];
u_int16_t s;
@@ -129,6 +127,8 @@ in6_cksum(m, nxt, off, len)
m->m_pkthdr.len, off, len);
}
+ bzero(&uph, sizeof(uph));
+
/*
* First create IP6 pseudo header and calculate a summary.
*/
OpenPOWER on IntegriCloud