svn commit: r240194 - releng/9.1/sys/netinet6
Bjoern A. Zeeb
bz at FreeBSD.org
Fri Sep 7 09:45:09 UTC 2012
Author: bz
Date: Fri Sep 7 09:45:08 2012
New Revision: 240194
URL: http://svn.freebsd.org/changeset/base/240194
Log:
MFC r238935,238960:
Properly apply #ifdef INET and leave a comment that we are (will) apply
delayed IPv6 checksum processing in ip6_output.c when doing IPsec.
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
Approved by: re (kib)
Modified:
releng/9.1/sys/netinet6/ip6_ipsec.c
releng/9.1/sys/netinet6/ip6_output.c
Directory Properties:
releng/9.1/sys/ (props changed)
Modified: releng/9.1/sys/netinet6/ip6_ipsec.c
==============================================================================
--- releng/9.1/sys/netinet6/ip6_ipsec.c Fri Sep 7 09:22:11 2012 (r240193)
+++ releng/9.1/sys/netinet6/ip6_ipsec.c Fri Sep 7 09:45:08 2012 (r240194)
@@ -291,16 +291,16 @@ ip6_ipsec_output(struct mbuf **m, struct
/*
* Do delayed checksums now because we send before
* this is done in the normal processing path.
- * XXX-BZ CSUM_DELAY_DATA_IPV6?
+ * For IPv6 we do delayed checksums in ip6_output.c.
*/
+#ifdef INET
if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
ipseclog((LOG_DEBUG,
"%s: we do not support IPv4 over IPv6", __func__));
-#ifdef INET
in_delayed_cksum(*m);
-#endif
(*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
+#endif
/*
* Preserve KAME behaviour: ENOENT can be returned
Modified: releng/9.1/sys/netinet6/ip6_output.c
==============================================================================
--- releng/9.1/sys/netinet6/ip6_output.c Fri Sep 7 09:22:11 2012 (r240193)
+++ releng/9.1/sys/netinet6/ip6_output.c Fri Sep 7 09:45:08 2012 (r240194)
@@ -304,6 +304,20 @@ ip6_output(struct mbuf *m0, struct ip6_p
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;
More information about the svn-src-all
mailing list