diff options
author | rrs <rrs@FreeBSD.org> | 2010-04-05 13:48:23 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2010-04-05 13:48:23 +0000 |
commit | 7228554bb6fa2507855ce8de0de33653584bc2c0 (patch) | |
tree | 26bfe93ce374bc41f7252309a753c7ebbb0cf5f9 /sys/netinet6/ip6_output.c | |
parent | 2fc7b4b4ff316df732131dd7a850e4c95d2ad576 (diff) | |
download | FreeBSD-src-7228554bb6fa2507855ce8de0de33653584bc2c0.zip FreeBSD-src-7228554bb6fa2507855ce8de0de33653584bc2c0.tar.gz |
MFC of 2 items to fix the csum for v6 issue:
Revision 205075 and 205104:
---------205075----------
With the recent change of the sctp checksum to support offload,
no delayed checksum was added to the ip6 output code. This
causes cards that do not support SCTP checksum offload to
have SCTP packets that are IPv6 NOT have the sctp checksum
performed. Thus you could not communicate with a peer. This
adds the missing bits to make the checksum happen for these cards.
-------------------------
---------205104----------
The proper fix for the delayed SCTP checksum is to
have the delayed function take an argument as to the offset
to the SCTP header. This allows it to work for V4 and V6.
This of course means changing all callers of the function
to either pass the header len, if they have it, or create
it (ip_hl << 2 or sizeof(ip6_hdr)).
-------------------------
PR: 144529
Diffstat (limited to 'sys/netinet6/ip6_output.c')
-rw-r--r-- | sys/netinet6/ip6_output.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index c2ec49a..a878aac 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" +#include "opt_sctp.h" #include <sys/param.h> #include <sys/kernel.h> @@ -102,6 +103,10 @@ __FBSDID("$FreeBSD$"); #include <netipsec/key.h> #include <netinet6/ip6_ipsec.h> #endif /* IPSEC */ +#ifdef SCTP +#include <netinet/sctp.h> +#include <netinet/sctp_crc32.h> +#endif #include <netinet6/ip6protosw.h> #include <netinet6/scope6_var.h> @@ -208,6 +213,9 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, struct route_in6 *ro_pmtu = NULL; int hdrsplit = 0; int needipsec = 0; +#ifdef SCTP + int sw_csum; +#endif #ifdef IPSEC struct ipsec_output_state state; struct ip6_rthdr *rh = NULL; @@ -829,6 +837,10 @@ again: } m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | CSUM_IP_VALID; +#ifdef SCTP + if (m->m_pkthdr.csum_flags & CSUM_SCTP) + m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; +#endif error = netisr_queue(NETISR_IPV6, m); goto done; } else @@ -857,6 +869,13 @@ passout: * 4: if dontfrag == 1 && alwaysfrag == 1 * error, as we cannot handle this conflicting request */ +#ifdef SCTP + sw_csum = m->m_pkthdr.csum_flags & ~ifp->if_hwassist; + if (sw_csum & CSUM_SCTP) { + sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); + sw_csum &= ~CSUM_SCTP; + } +#endif tlen = m->m_pkthdr.len; if (opt && (opt->ip6po_flags & IP6PO_DONTFRAG)) |