HomeFreeBSD

pfil: add pfil_mem_{in,out}() and retire pfil_run_hooks()

Description

pfil: add pfil_mem_{in,out}() and retire pfil_run_hooks()

The 0b70e3e78b0 changed the original design of a single entry point
into pfil(9) chains providing separate functions for the filtering
points that always provide mbufs and know the direction of a flow.
The motivation was to reduce branching. The logical continuation
would be to do the same for the filtering points that always provide
a memory pointer and retire the single entry point.

o Hooks now provide two functions: one for mbufs and optional for

memory pointers.

o pfil_hook_args() has a new member and pfil_add_hook() has a

requirement to zero out uninitialized data. Bump PFIL_VERSION.

o As it was before, a hook function for a memory pointer may realloc

into an mbuf.  Such mbuf would be returned via a pointer that must
be provided in argument.

o The only hook that supports memory pointers is ipfw:default-link.

It is rewritten to provide two functions.

o All remaining uses of pfil_run_hooks() are converted to

pfil_mem_in().

o Transparent union of pfil_packet_t and tricks to fix pointer

alignment are retired. Internal pfil_realloc() reduces down to
m_devget() and thus is retired, too.

Reviewed by: mjg, ocochard
Differential revision: https://reviews.freebsd.org/D37977

Details

Provenance
glebiusAuthored on Feb 14 2023, 6:02 PM
Reviewer
mjg
Differential Revision
D37977: pfil: add pfil_mem_{in,out}() and retire pfil_run_hooks()
Parents
rGa22561501ff8: net: use pfil_mbuf_{in,out} where we always have an mbuf
Branches
Unknown
Tags
Unknown