git: 61c7534e5b15 - stable/13 - TCP syncache: enhance KASSERT output

From: Bjoern A. Zeeb <>
Date: Sun, 20 Feb 2022 18:15:31 UTC
The branch stable/13 has been updated by bz:


commit 61c7534e5b1560d7fb08a3f080b8af8301216469
Author:     Bjoern A. Zeeb <>
AuthorDate: 2022-02-08 23:47:15 +0000
Commit:     Bjoern A. Zeeb <>
CommitDate: 2022-02-20 16:23:21 +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
    Differential Revision:
    (cherry picked from commit 232d323ef227109acce37f5a0d62492673666ee2)
 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 e7fb8da52216..54bcf8173c86 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1850,7 +1850,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);