Main index | Section 9 | Options |
#include <sys/param.h>
#include <sys/mbuf.h>
#include <net/pfil.h>
Packet filtering points, for historical reasons named heads, are registered with pfil_head_register(). The function is supplied with special versioned struct pfil_head_args structure that specifies type and features of the head as well as human readable name. If the filtering point to be ever destroyed, the subsystem that created it must unregister it with call to pfil_head_unregister().
Packet filtering systems may register arbitrary number of filters, for historical reasons named hooks. To register a new hook pfil_add_hook() with special versioned struct pfil_hook_args structure is called. The structure specifies type and features of the hook, pointer to the actual filtering function and user readable name of the filtering module and ruleset name. Later hooks can be removed with pfil_remove_hook() functions.
To connect existing hook to an existing head function pfil_link() shall be used. The function is supplied with versioned struct pfil_link_args structure that specifies either literal names of hook and head or pointers to them. Typically pfil_link() is called by filtering modules to autoregister their default ruleset and default filtering points. It also serves on the kernel side of ioctl(2) when user changes pfil configuration with help of pfilctl(8) utility.
For every packet traveling through a head the latter shall invoke pfil_run_hooks(). The function can accept either struct mbuf * pointer or a void * pointer and length. In case if a hooked filtering module cannot understand void * pointer pfil will provide it with a fake one. All calls to pfil_run_hooks() are performed in network epoch(9).
inet | IPv4 packets. |
inet6 | IPv6 packets. |
ethernet | |
Link-layer packets. | |
Default rulesets are automatically linked to these heads to preserve historical behaviour.
PFIL (9) | January 28, 2019 |
Main index | Section 9 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.