aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-06-18 10:41:51 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-06-18 10:41:51 +0000
commit1ae4bac217163b0cfd834213dbe1d64464baef5b (patch)
tree212f86d18e7acfcf2f45a4bdefa5ea853d666c39
parente5fce44e5127a0f7454203b837487cf86986fc55 (diff)
downloadsrc-1ae4bac217163b0cfd834213dbe1d64464baef5b.tar.gz
src-1ae4bac217163b0cfd834213dbe1d64464baef5b.zip
MFC r362045:
Make sure packets generated by raw IP code is let through by mlx5en(4). Allow the TCP header to reside in the mbuf following the IP header. Else such packets will get dropped. Backtrace: mlx5e_sq_xmit() mlx5e_xmit() ether_output_frame() ether_output() ip_output_send() ip_output() rip_output() sosend_generic() sosend() kern_sendit() sendit() sys_sendto() amd64_syscall() fast_syscall_common() Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/stable/10/; revision=362313
-rw-r--r--sys/dev/mlx5/mlx5_en/mlx5_en_tx.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
index 7040e724a03a..d36e723fea33 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
@@ -228,9 +228,15 @@ mlx5e_get_header_size(const struct mbuf *mb)
default:
return (0);
}
- if (unlikely(mb->m_len < eth_hdr_len + sizeof(*th)))
- return (0);
- th = (const struct tcphdr *)(mb->m_data + eth_hdr_len);
+ if (unlikely(mb->m_len < eth_hdr_len + sizeof(*th))) {
+ const struct mbuf *m_th = mb->m_next;
+ if (unlikely(mb->m_len != eth_hdr_len ||
+ m_th == NULL || m_th->m_len < sizeof(*th)))
+ return (0);
+ th = (const struct tcphdr *)(m_th->m_data);
+ } else {
+ th = (const struct tcphdr *)(mb->m_data + eth_hdr_len);
+ }
tcp_hlen = th->th_off << 2;
eth_hdr_len += tcp_hlen;
/*