git: 39f7de587b7f - main - divert_packet: ip is only used for SCTP.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Apr 2022 23:10:09 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=39f7de587b7f0c5d8e17134d2bfde111a07f2b8c
commit 39f7de587b7f0c5d8e17134d2bfde111a07f2b8c
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-13 23:08:23 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-13 23:08:23 +0000
divert_packet: ip is only used for SCTP.
---
sys/netinet/ip_divert.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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;
}