TCP syncache: enhance KASSERT output

Improve the "syncache: mbuf too small" assertion message with various
variables (some not actually needed) but enough that it will be obvious
if (a) we use IPv4 or IPv6, (b) if UDP tunneling is on, (c) what
max_linkhdr is, and (d) what MHLEN is.

This should help diagnostics in the future.
The case was hit with wireless drivers setting a large ic_headroom
and using IPv6.

Reviewed by:	gallatin, tuexen, rscheff
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D34217
This commit is contained in:
Bjoern A. Zeeb 2022-02-08 23:47:15 +00:00
parent ec042f46e9
commit 232d323ef2

View File

@ -1848,7 +1848,9 @@ syncache_respond(struct syncache *sc, const struct mbuf *m0, int flags)
/* XXX: Assume that the entire packet will fit in a header mbuf. */
KASSERT(max_linkhdr + tlen + TCP_MAXOLEN <= MHLEN,
("syncache: mbuf too small"));
("syncache: mbuf too small: hlen %u, sc_port %u, max_linkhdr %d + "
"tlen %d + TCP_MAXOLEN %ju <= MHLEN %d", hlen, sc->sc_port,
max_linkhdr, tlen, (uintmax_t)TCP_MAXOLEN, MHLEN));
/* Create the IP+TCP header from scratch. */
m = m_gethdr(M_NOWAIT, MT_DATA);