Re: panic: syncache: mbuf too small

From: Bjoern A. Zeeb <bzeeb-lists_at_lists.zabbadoz.net>
Date: Thu, 10 Feb 2022 17:59:00 UTC
On Wed, 9 Feb 2022, Drew Gallatin wrote:

> Good point.  It looks like TCP already does this for tcp_output():
>
> #ifdef INET6
>                if (MHLEN < hdrlen + max_linkhdr)
>                        m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
>                else
> #endif
>                        m = m_gethdr(M_NOWAIT, MT_DATA);
>

A few comments:

(a) there's no reason anymore (especially after the bwn/bwi numbers I
saw) that the above is limited to IPv6 so that #ifdef should go; and
without looking at the code I'd hope there'd be a follow-up length
check.

(b) if one wireless driver bumps max_linkhdr on the system it bumps
it for everything; in theory we could do it on a per-interface basis
but that's just route lookups and all kinds of things probably not in
the right place these days and more complications.

(c) despite (b) of course a "server" w/o wireless or a machine without
a problemtic driver would currently not hit the more pessimistic path
and be good with m_gethdr() in these cases.

(d) I currently can avoid (and successfully did) this with the rtw88
which triggered it for me;  eventually I'll have to find a better
solution for it but for the next weeks I'll be good.

(e) So even if we are good for now, looking through mbuf.h made me
"cry" the other day.  It's very well engineered but the simplicity it
once had is long gone; but that remains a story for another day (maybe
the 2nd half of this year).

/bz

-- 
Bjoern A. Zeeb                                                     r15:7