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
This commit is contained in:
Zhenlei Huang 2024-04-09 00:44:33 +08:00
parent 7e68976408
commit e7102929bf

View file

@ -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);