Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/ip_divert.c
Show First 20 Lines • Show All 206 Lines • ▼ Show 20 Lines | divert_packet(struct mbuf *m, bool incoming) | ||||
/* Assure header */ | /* Assure header */ | ||||
if (m->m_len < sizeof(struct ip) && | if (m->m_len < sizeof(struct ip) && | ||||
(m = m_pullup(m, sizeof(struct ip))) == NULL) | (m = m_pullup(m, sizeof(struct ip))) == NULL) | ||||
return; | return; | ||||
ip = mtod(m, struct ip *); | ip = mtod(m, struct ip *); | ||||
/* Delayed checksums are currently not compatible with divert. */ | /* Delayed checksums are currently not compatible with divert. */ | ||||
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { | if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { | ||||
m = mb_unmapped_to_ext(m); | |||||
if (m == NULL) | |||||
return; | |||||
in_delayed_cksum(m); | in_delayed_cksum(m); | ||||
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; | m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; | ||||
} | } | ||||
#if defined(SCTP) || defined(SCTP_SUPPORT) | #if defined(SCTP) || defined(SCTP_SUPPORT) | ||||
if (m->m_pkthdr.csum_flags & CSUM_SCTP) { | if (m->m_pkthdr.csum_flags & CSUM_SCTP) { | ||||
sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); | sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); | ||||
m->m_pkthdr.csum_flags &= ~CSUM_SCTP; | m->m_pkthdr.csum_flags &= ~CSUM_SCTP; | ||||
} | } | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { | if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { | ||||
m = mb_unmapped_to_ext(m); | |||||
if (m == NULL) | |||||
return; | |||||
in6_delayed_cksum(m, m->m_pkthdr.len - | in6_delayed_cksum(m, m->m_pkthdr.len - | ||||
sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); | sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); | ||||
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; | m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; | ||||
} | } | ||||
#if defined(SCTP) || defined(SCTP_SUPPORT) | #if defined(SCTP) || defined(SCTP_SUPPORT) | ||||
if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { | if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { | ||||
sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); | sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); | ||||
m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; | m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; | ||||
▲ Show 20 Lines • Show All 628 Lines • Show Last 20 Lines |