mbuf w/o pkthdr?

Giorgos Keramidas keramida at freebsd.org
Tue Oct 12 08:57:46 PDT 2004


On 2004-10-12 17:36, Dag-Erling Sm?rgrav <des at des.no> wrote:
> Sam <sah at softcardsystems.com> writes:
> > Are all packets supposed to have the M_PKTHDR flag?  Why?
>
> IIRC, M_PKTHDR indicates the first mbuf in a chain when a packet is
> split across multiple mbufs.  This usually only happens for outgoing
> packets, where protocol headers are constructed in separate mbufs
> which are prepended to the chain as the packet moves down the stack.

AFAIK, all the packets have an M_PKTHDR in the first mbuf of their
chain.  The presence of an M_PKTHDR flag only means that the beginning
of the mbuf contains a (struct pkthdr) before the packet payload.

This is not related to the splitting of packets to multiple mbufs or
not, though.  A small packet might have an M_PKTHDR but still fit in
a single mbuf if its payload packet (including protocol headers and
data) is less than MHLEN bytes.



More information about the freebsd-current mailing list