move file static variable into auto variable, for better thread safety.

(not really required for big lock MP).  sync with kame
This commit is contained in:
itojun 2000-09-09 16:15:47 +00:00
parent f8481d085e
commit 2192675fb1
1 changed files with 12 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/* $NetBSD: in6_cksum.c,v 1.8 2000/09/09 11:42:22 itojun Exp $ */
/* $KAME: in6_cksum.c,v 1.7 2000/09/09 11:38:10 itojun Exp $ */
/* $NetBSD: in6_cksum.c,v 1.9 2000/09/09 16:15:47 itojun 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 __attribute__((__packed__));
} 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.
*/