git: e7102929bf4f - main - ethernet: Fix logging of frame length
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 08 Apr 2024 16:46:01 UTC
The branch main has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=e7102929bf4fea4bf22855d2d6031edf6c413608
commit e7102929bf4fea4bf22855d2d6031edf6c413608
Author: Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-04-08 16:44:33 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-04-08 16:44:33 +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
---
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 4332f4ce864e..eeb2c1ea4ef3 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -534,10 +534,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);