diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2014-01-24 12:20:23 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2014-01-24 12:20:23 +0000 |
commit | d0fdd8684d6e70af4b7d87a11326594c709e4f33 (patch) | |
tree | d71174dace67cef3670a31e65ca485dbbdaf11b7 /sys | |
parent | 651d5ce98e5870a5c9d154e240533295ad2d14b6 (diff) |
Instead of calculating the ICMPv6 checksum here, just set the flag that
is needed and the lower parts of the stack will take care of it.
ok henning@, lteo@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet6/icmp6.c | 8 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 5 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 8 |
3 files changed, 8 insertions, 13 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 325a211019a..f98f13eb4b2 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.139 2014/01/13 23:03:52 bluhm Exp $ */ +/* $OpenBSD: icmp6.c,v 1.140 2014/01/24 12:20:22 naddy Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -2100,8 +2100,7 @@ icmp6_reflect(struct mbuf *m, size_t off) ip6->ip6_hlim = ip6_defhlim; icmp6->icmp6_cksum = 0; - icmp6->icmp6_cksum = in6_cksum(m, IPPROTO_ICMPV6, - sizeof(struct ip6_hdr), plen); + m->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT; /* * XXX option handling @@ -2611,8 +2610,7 @@ noredhdropt: ip6->ip6_plen = htons(m->m_pkthdr.len - sizeof(struct ip6_hdr)); nd_rd->nd_rd_cksum = 0; - nd_rd->nd_rd_cksum - = in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), ntohs(ip6->ip6_plen)); + m->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT; /* send the packet to outside... */ if (ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL) != 0) diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index d0058336823..09c42e89027 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mld6.c,v 1.36 2014/01/21 10:18:26 mpi Exp $ */ +/* $OpenBSD: mld6.c,v 1.37 2014/01/24 12:20:22 naddy Exp $ */ /* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */ /* @@ -435,8 +435,7 @@ mld6_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst) mldh->mld_addr = in6m->in6m_addr; if (IN6_IS_ADDR_MC_LINKLOCAL(&mldh->mld_addr)) mldh->mld_addr.s6_addr16[1] = 0; /* XXX */ - mldh->mld_cksum = in6_cksum(mh, IPPROTO_ICMPV6, sizeof(struct ip6_hdr), - sizeof(struct mld_hdr)); + mh->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT; /* construct multicast option */ bzero(&im6o, sizeof(im6o)); diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 587a561cc93..6acdc43453a 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.74 2014/01/13 23:03:52 bluhm Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.75 2014/01/24 12:20:22 naddy Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -520,8 +520,7 @@ nd6_ns_output(struct ifnet *ifp, struct in6_addr *daddr6, ip6->ip6_plen = htons((u_short)icmp6len); nd_ns->nd_ns_cksum = 0; - nd_ns->nd_ns_cksum = - in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), icmp6len); + m->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT; ip6_output(m, NULL, &ro, dad ? IPV6_UNSPECSRC : 0, &im6o, NULL, NULL); icmp6_ifstat_inc(ifp, ifs6_out_msg); @@ -1034,8 +1033,7 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6, ip6->ip6_plen = htons((u_short)icmp6len); nd_na->nd_na_flags_reserved = flags; nd_na->nd_na_cksum = 0; - nd_na->nd_na_cksum = - in6_cksum(m, IPPROTO_ICMPV6, sizeof(struct ip6_hdr), icmp6len); + m->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT; ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL); |