Index: sys/netipsec/ipsec_output.c =================================================================== --- sys/netipsec/ipsec_output.c +++ sys/netipsec/ipsec_output.c @@ -323,14 +323,22 @@ * this is done in the normal processing path. */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m = mb_unmapped_to_ext(m); + if (m == NULL) { + IPSECSTAT_INC(ips_out_nomem); + return (ENOBUFS); + } in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) { - struct ip *ip = mtod(m, struct ip *); - - sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); + m = mb_unmapped_to_ext(m); + if (m == NULL) { + IPSECSTAT_INC(ips_out_nomem); + return (ENOBUFS); + } + sctp_delayed_cksum(m, mtod(m, struct ip *)->ip_hl << 2); m->m_pkthdr.csum_flags &= ~CSUM_SCTP; } #endif