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
This commit is contained in:
Bjoern A. Zeeb 2012-07-31 23:34:06 +00:00
parent adebcba798
commit 3b43b78342
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238960

View File

@ -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;