diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2012-11-06 12:32:43 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2012-11-06 12:32:43 +0000 |
commit | cdb55f2492d4777204a5a27b340ac160f237054a (patch) | |
tree | 80a626642d88e29ab1ec6b295d4799011726e9a6 /sys/netinet6 | |
parent | 0a997370e6625d6631c40501416aa015179279b0 (diff) |
backout csum diff for the moment, requested by theo
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.h | 3 | ||||
-rw-r--r-- | sys/netinet6/ip6_divert.c | 5 | ||||
-rw-r--r-- | sys/netinet6/ip6_forward.c | 5 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 5 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 65 |
5 files changed, 6 insertions, 77 deletions
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h index ad01de151cb..778e8784ce6 100644 --- a/sys/netinet6/in6.h +++ b/sys/netinet6/in6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.h,v 1.60 2012/11/01 07:55:56 henning Exp $ */ +/* $OpenBSD: in6.h,v 1.61 2012/11/06 12:32:42 henning Exp $ */ /* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */ /* @@ -758,7 +758,6 @@ struct ip6_mtuinfo { struct cmsghdr; int in6_cksum(struct mbuf *, u_int8_t, u_int32_t, u_int32_t); -extern void in6_proto_cksum_out(struct mbuf *, struct ifnet *); int in6_localaddr(struct in6_addr *); int in6_addrscope(struct in6_addr *); struct in6_ifaddr *in6_ifawithscope(struct ifnet *, struct in6_addr *, u_int); diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c index 603c7995625..c985cdfec1d 100644 --- a/sys/netinet6/ip6_divert.c +++ b/sys/netinet6/ip6_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_divert.c,v 1.7 2012/11/01 07:55:56 henning Exp $ */ +/* $OpenBSD: ip6_divert.c,v 1.8 2012/11/06 12:32:42 henning Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -188,9 +188,6 @@ divert6_packet(struct mbuf *m, int dir) break; } } - /* force checksum calculation */ - if (dir == PF_OUT) - in6_proto_cksum_out(m, NULL); if (inp != CIRCLEQ_END(&divb6table.inpt_queue)) { sa = inp->inp_socket; diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index 2cb614c2bb7..caa67d3099d 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_forward.c,v 1.56 2012/11/05 21:49:15 claudio Exp $ */ +/* $OpenBSD: ip6_forward.c,v 1.57 2012/11/06 12:32:42 henning Exp $ */ /* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */ /* @@ -370,7 +370,6 @@ reroute: * What's the behaviour? */ #endif - in6_proto_cksum_out(m, encif); m->m_flags &= ~(M_BCAST | M_MCAST); /* just in case */ @@ -471,6 +470,7 @@ reroute: } if (m == NULL) goto senderr; + ip6 = mtod(m, struct ip6_hdr *); if ((m->m_pkthdr.pf.flags & (PF_TAG_REROUTE | PF_TAG_GENERATED)) == (PF_TAG_REROUTE | PF_TAG_GENERATED)) { @@ -483,7 +483,6 @@ reroute: goto reroute; } #endif - in6_proto_cksum_out(m, rt->rt_ifp); /* Check the size after pf_test to give pf a chance to refragment. */ if (m->m_pkthdr.len > IN6_LINKMTU(rt->rt_ifp)) { diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 3cbd344b3da..e45b80885d0 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.104 2012/11/01 07:55:56 henning Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.105 2012/11/06 12:32:42 henning Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -670,9 +670,6 @@ ip6_input(struct mbuf *m) return; } - /* pf might have changed things */ - in6_proto_cksum_out(m, NULL); - ip6 = mtod(m, struct ip6_hdr *); /* diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 8ac4566b4b9..cc271fe7cf4 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.131 2012/11/05 21:49:15 claudio Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.132 2012/11/06 12:32:42 henning Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -134,8 +134,6 @@ int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *); int ip6_getpmtu(struct route_in6 *, struct route_in6 *, struct ifnet *, struct in6_addr *, u_long *, int *); int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int); -void in6_delayed_cksum(struct mbuf *, u_int8_t); -void in6_proto_cksum_out(struct mbuf *, struct ifnet *); /* Context for non-repeating IDs */ struct idgen32_ctx ip6_id_ctx; @@ -543,7 +541,6 @@ reroute: * What's the behaviour? */ #endif - in6_proto_cksum_out(m, encif); m->m_flags &= ~(M_BCAST | M_MCAST); /* just in case */ @@ -819,7 +816,6 @@ reroute: goto reroute; } #endif - in6_proto_cksum_out(m, ifp); /* * Send the packet to the outgoing interface. @@ -3218,62 +3214,3 @@ ip6_randomid_init(void) { idgen32_init(&ip6_id_ctx); } - -/* - * Process a delayed payload checksum calculation. - */ -void -in6_delayed_cksum(struct mbuf *m, u_int8_t nxt) -{ - int nxtp, offset; - u_int16_t csum; - - offset = ip6_lasthdr(m, 0, IPPROTO_IPV6, &nxtp); - if (offset <= 0 || nxtp != nxt) - /* If the desired next protocol isn't found, punt. */ - return; - - csum = (u_int16_t)(in6_cksum(m, nxt, offset, m->m_pkthdr.len - offset)); - - switch (nxt) { - case IPPROTO_TCP: - offset += offsetof(struct tcphdr, th_sum); - break; - - case IPPROTO_UDP: - offset += offsetof(struct udphdr, uh_sum); - if (csum == 0) - csum = 0xffff; - break; - - case IPPROTO_ICMPV6: - offset += offsetof(struct icmp6_hdr, icmp6_cksum); - break; - } - - if ((offset + sizeof(u_int16_t)) > m->m_len) - m_copyback(m, offset, sizeof(csum), &csum, M_NOWAIT); - else - *(u_int16_t *)(mtod(m, caddr_t) + offset) = csum; -} - -void -in6_proto_cksum_out(struct mbuf *m, struct ifnet *ifp) -{ - if (m->m_pkthdr.csum_flags & M_TCP_CSUM_OUT) { - if (!ifp || !(ifp->if_capabilities & IFCAP_CSUM_TCPv6) || - ifp->if_bridgeport != NULL) { - in6_delayed_cksum(m, IPPROTO_TCP); - m->m_pkthdr.csum_flags &= ~M_TCP_CSUM_OUT; /* Clear */ - } - } else if (m->m_pkthdr.csum_flags & M_UDP_CSUM_OUT) { - if (!ifp || !(ifp->if_capabilities & IFCAP_CSUM_UDPv6) || - ifp->if_bridgeport != NULL) { - in6_delayed_cksum(m, IPPROTO_UDP); - m->m_pkthdr.csum_flags &= ~M_UDP_CSUM_OUT; /* Clear */ - } - } else if (m->m_pkthdr.csum_flags & M_ICMP_CSUM_OUT) { - in6_delayed_cksum(m, IPPROTO_ICMPV6); - m->m_pkthdr.csum_flags &= ~M_ICMP_CSUM_OUT; /* Clear */ - } -} |