HomeFreeBSD

Add ipsec_prepend() - optimized version of M_PREPEND().

Description

Add ipsec_prepend() - optimized version of M_PREPEND().

We use M_PREPEND() to prepend outer IP header for tunnel mode SA.
This may lead to allocation of new mbuf, that will be aligned to
the end of mbuf's data, i.e. all unused space is at the beginning of
the mbuf. After IP encapsulation some IPsec transforms is performed.
This inserts new ESP/AH/IPCOMP header just after outer IP header.
Since mbuf is aligned, m_makespace() needs to allocate new mbuf, or
copy all data after outer IP header into new place to prepare the
space for ESP/AH/IPCOMP header.

To avoid this, ipsec_prepend() reserves space at the beginning to be able
place link level header, and at the end, to be able place ESP/AH/IPCOMP
header.

Also modify m_makespace() to handle the case, when at the beginning of
mbuf is enough space to move outer IP header, instead of moving all
remaining data to the end of mbuf.

Details

Provenance
aeAuthored on
Parents
rS310709: sfxge(4): fix invalid type of eft_unicst_filter_count
Branches
Unknown
Tags
Unknown