Allocate a chunk of M_TEMP memory and struct iovec on the stack instead.
The allocating function user_sendit() (or compatibility siblings) is
responsible for freeing the memory. The pointer to iovec is passed down
to a protocol. Provide cmsg_nxthdr(), a kernel version of CMSG_NXTHDR().
- Gets us closer to getting rid of MT_CONTROL, which could be just one of M_PROTO flags instead.
- Makes things simplier for protocols that ignore control data.
Using an mbuf for this purpose was a BSD relic that early in the syscall
stack the control data is copied into an mbuf(4) and then protocol methods
are responsible for freeing it. This design was probably based on that
with sockets API the control data is linked into the socket buffer, which
consists of mbufs. In reality most protocols process the control data
rather than link it into the buffer. The exception is unix(4), but it
still processes the control data to internalize it and allocates new mbufs
to be linked into a socket buffer.
Note on SCTP. SCTP has a strange thing of storing control on its pcb. On
next send(2) this control would be freed. This could be leftovers of
debugging, I guess. This was removed.