git: 65212656f845 - stable/13 - ethernet: Fix logging of frame length
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 15 Apr 2024 04:03:37 UTC
The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=65212656f845088417881219b5bd0f6355dd50fe commit 65212656f845088417881219b5bd0f6355dd50fe Author: Zhenlei Huang <zlei@FreeBSD.org> AuthorDate: 2024-04-08 16:44:33 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2024-04-15 04:02:57 +0000 ethernet: Fix logging of frame length Both the mbuf length and the total packet length are signed. While here, update a stall comment to reflect the current practice. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42390 (cherry picked from commit e7102929bf4fea4bf22855d2d6031edf6c413608) (cherry picked from commit 4d65728d55a754f2529ca2cfb87c9588146563d0) --- sys/net/if_ethersubr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index b361af2fe428..c0b2b4f3f448 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -529,10 +529,10 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m) return; } #endif - if (m->m_len < ETHER_HDR_LEN) { - /* XXX maybe should pullup? */ + if (__predict_false(m->m_len < ETHER_HDR_LEN)) { + /* Drivers should pullup and ensure the mbuf is valid */ if_printf(ifp, "discard frame w/o leading ethernet " - "header (len %u pkt len %u)\n", + "header (len %d pkt len %d)\n", m->m_len, m->m_pkthdr.len); if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); m_freem(m);