aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_divert.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-04-13 23:08:23 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-04-13 23:08:23 +0000
commit39f7de587b7f0c5d8e17134d2bfde111a07f2b8c (patch)
tree35137fa28063d47b48a929d67f29b034b4a45366 /sys/netinet/ip_divert.c
parentfe5324aca06e80112199c08139f3b9ca77b54f71 (diff)
downloadsrc-39f7de587b7f0c5d8e17134d2bfde111a07f2b8c.tar.gz
src-39f7de587b7f0c5d8e17134d2bfde111a07f2b8c.zip
divert_packet: ip is only used for SCTP.
Diffstat (limited to 'sys/netinet/ip_divert.c')
-rw-r--r--sys/netinet/ip_divert.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 6c4d85b03e6a..a745073d1ec0 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -178,7 +178,9 @@ div_port_match(const struct inpcb *inp, void *v)
static void
divert_packet(struct mbuf *m, bool incoming)
{
+#if defined(SCTP) || defined(SCTP_SUPPORT)
struct ip *ip;
+#endif
struct inpcb *inp;
struct socket *sa;
u_int16_t nport;
@@ -198,7 +200,6 @@ divert_packet(struct mbuf *m, bool incoming)
if (m->m_len < sizeof(struct ip) &&
(m = m_pullup(m, sizeof(struct ip))) == NULL)
return;
- ip = mtod(m, struct ip *);
/* Delayed checksums are currently not compatible with divert. */
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
@@ -207,6 +208,7 @@ divert_packet(struct mbuf *m, bool incoming)
}
#if defined(SCTP) || defined(SCTP_SUPPORT)
if (m->m_pkthdr.csum_flags & CSUM_SCTP) {
+ ip = mtod(m, struct ip *);
sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
}