Author: bz
Date: Tue Jul 31 23:34:06 2012
New Revision: 238960
URL: http://svn.freebsd.org/changeset/base/238960

Log:
  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

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c      Tue Jul 31 22:25:29 2012        
(r238959)
+++ head/sys/netinet6/ip6_output.c      Tue Jul 31 23:34:06 2012        
(r238960)
@@ -306,6 +306,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;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to