HomeFreeBSD

Most Ethernet drivers that potentially can run a pfil(9) hook with

Description

Most Ethernet drivers that potentially can run a pfil(9) hook with
PFIL_MEMPTR flag are intentionally providing a memory address that
isn't aligned to pointer alignment. This is done to align an IPv4
or IPv6 header that is expected to follow Ethernet header.

When we return PFIL_REALLOCED we store a pointer to allocated mbuf
at this address. With this change the KPI changes to store the pointer
at aligned address, which usually yields in +2 bytes.

Provide two inlines:

pfil_packet_align() to get aligned pfil_packet_t for a misaligned one
pfil_mem2mbuf() to read out mbuf pointer from misaligned pfil_packet_t

Provide function pfil_realloc(), not used yet, that would convert a
memory pfil_packet_t to an mbuf one.

Reported by: hps
Reviewed by: hps, gallatin

Details

Committed
glebiusMar 10 2019, 5:20 PM
Reviewer
gallatin
Parents
rS344979: Properly handle a case when a first filter returns PFIL_REALLOCED, then
Branches
Unknown
Tags
Unknown