summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2012-07-31 23:34:06 +0000
committerbz <bz@FreeBSD.org>2012-07-31 23:34:06 +0000
commit73fec218b58931ed8164f0f5054811095e817f58 (patch)
tree524013d4be4c097a6fd82dba247bf7eec4696258
parenta95bb8c0ec16ef3e46a85601d82fdf3951a83488 (diff)
downloadFreeBSD-src-73fec218b58931ed8164f0f5054811095e817f58.zip
FreeBSD-src-73fec218b58931ed8164f0f5054811095e817f58.tar.gz
In case of IPsec he have to do delayed checksum calculations before
adding any extension header, or rather before calling into IPsec processing as we may send the packet and not return to IPv6 output processing here. PR: kern/170116 MFC After: 3 days
-rw-r--r--sys/netinet6/ip6_output.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 9270d89..1fdedf1 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -306,6 +306,20 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
goto freehdrs;
case -1: /* Do IPSec */
needipsec = 1;
+ /*
+ * Do delayed checksums now, as we may send before returning.
+ */
+ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
+ plen = m->m_pkthdr.len - sizeof(*ip6);
+ in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr));
+ m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
+ }
+#ifdef SCTP
+ if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) {
+ sctp_delayed_cksum(m, sizeof(struct ip6_hdr));
+ m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6;
+ }
+#endif
case 0: /* No IPSec */
default:
break;
OpenPOWER on IntegriCloud