git: 232d323ef227 - main - TCP syncache: enhance KASSERT output

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 14 Feb 2022 00:07:58 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=232d323ef227109acce37f5a0d62492673666ee2

commit 232d323ef227109acce37f5a0d62492673666ee2
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-02-08 23:47:15 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-02-14 00:03:20 +0000

    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
---
 sys/netinet/tcp_syncache.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index ed4adda59c22..ed5981bf85d7 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -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);