Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 avoid possible alignment issue. sync with kame
details: https://anonhg.NetBSD.org/src/rev/beb57bce4d6b
branches: trunk
changeset: 504537:beb57bce4d6b
user: itojun <itojun%NetBSD.org@localhost>
date: Sun Mar 04 16:49:17 2001 +0000
description:
avoid possible alignment issue. sync with kame
diffstat:
sys/netinet6/raw_ip6.c | 21 +++++++--------------
1 files changed, 7 insertions(+), 14 deletions(-)
diffs (43 lines):
diff -r 5deb36017a77 -r beb57bce4d6b sys/netinet6/raw_ip6.c
--- a/sys/netinet6/raw_ip6.c Sun Mar 04 16:24:39 2001 +0000
+++ b/sys/netinet6/raw_ip6.c Sun Mar 04 16:49:17 2001 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: raw_ip6.c,v 1.30 2001/02/26 07:20:45 itojun Exp $ */
-/* $KAME: raw_ip6.c,v 1.66 2001/02/26 06:33:14 itojun Exp $ */
+/* $NetBSD: raw_ip6.c,v 1.31 2001/03/04 16:49:17 itojun Exp $ */
+/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -469,9 +469,8 @@
if (so->so_proto->pr_protocol == IPPROTO_ICMPV6 ||
in6p->in6p_cksum != -1) {
- struct mbuf *n;
int off;
- u_int16_t *p;
+ u_int16_t sum;
#define offsetof(type, member) ((size_t)(&((type *)0)->member)) /* XXX */
@@ -486,16 +485,10 @@
}
off += sizeof(struct ip6_hdr);
- n = m;
- while (n && n->m_len <= off) {
- off -= n->m_len;
- n = n->m_next;
- }
- if (!n)
- goto bad;
- p = (u_int16_t *)(mtod(n, caddr_t) + off);
- *p = 0;
- *p = in6_cksum(m, ip6->ip6_nxt, sizeof(*ip6), plen);
+ sum = 0;
+ m_copyback(m, off, sizeof(sum), (caddr_t)&sum);
+ sum = in6_cksum(m, ip6->ip6_nxt, sizeof(*ip6), plen);
+ m_copyback(m, off, sizeof(sum), (caddr_t)&sum);
}
#ifdef IPSEC
Home |
Main Index |
Thread Index |
Old Index