Author: bz
Date: Wed Aug 29 13:19:27 2012
New Revision: 239832
URL: http://svn.freebsd.org/changeset/base/239832

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

Modified:
  stable/9/sys/netinet6/ip6_output.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet6/ip6_output.c
==============================================================================
--- stable/9/sys/netinet6/ip6_output.c  Wed Aug 29 13:14:39 2012        
(r239831)
+++ stable/9/sys/netinet6/ip6_output.c  Wed Aug 29 13:19:27 2012        
(r239832)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to