]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
New pfil(9) KPI together with newborn pfil API and control utility.
authorglebius <glebius@FreeBSD.org>
Thu, 31 Jan 2019 23:01:03 +0000 (23:01 +0000)
committerglebius <glebius@FreeBSD.org>
Thu, 31 Jan 2019 23:01:03 +0000 (23:01 +0000)
commit9978a7d9242f744fc7473e287332c8df88e33e3e
tree129539f21574fd57abdc128138912eeee023fc89
parent4e4796faba6bd1470ad4607508760cf6b7aabeb2
New pfil(9) KPI together with newborn pfil API and control utility.

The KPI have been reviewed and cleansed of features that were planned
back 20 years ago and never implemented.  The pfil(9) internals have
been made opaque to protocols with only returned types and function
declarations exposed. The KPI is made more strict, but at the same time
more extensible, as kernel uses same command structures that userland
ioctl uses.

In nutshell [KA]PI is about declaring filtering points, declaring
filters and linking and unlinking them together.

New [KA]PI makes it possible to reconfigure pfil(9) configuration:
change order of hooks, rehook filter from one filtering point to a
different one, disconnect a hook on output leaving it on input only,
prepend/append a filter to existing list of filters.

Now it possible for a single packet filter to provide multiple rulesets
that may be linked to different points. Think of per-interface ACLs in
Cisco or Juniper. None of existing packet filters yet support that,
however limited usage is already possible, e.g. default ruleset can
be moved to single interface, as soon as interface would pride their
filtering points.

Another future feature is possiblity to create pfil heads, that provide
not an mbuf pointer but just a memory pointer with length. That would
allow filtering at very early stages of a packet lifecycle, e.g. when
packet has just been received by a NIC and no mbuf was yet allocated.

Differential Revision: https://reviews.freebsd.org/D18951
27 files changed:
ObsoleteFiles.inc
sbin/Makefile
sbin/pfilctl/Makefile [new file with mode: 0644]
sbin/pfilctl/pfilctl.8 [new file with mode: 0644]
sbin/pfilctl/pfilctl.c [new file with mode: 0644]
share/man/man9/Makefile
share/man/man9/pfil.9
sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
sys/net/if_bridge.c
sys/net/if_enc.c
sys/net/if_ethersubr.c
sys/net/if_var.h
sys/net/pfil.c
sys/net/pfil.h
sys/netinet/ip_fastfwd.c
sys/netinet/ip_input.c
sys/netinet/ip_output.c
sys/netinet/ip_var.h
sys/netinet/siftr.c
sys/netinet6/ip6_fastfwd.c
sys/netinet6/ip6_forward.c
sys/netinet6/ip6_input.c
sys/netinet6/ip6_output.c
sys/netinet6/ip6_var.h
sys/netpfil/ipfw/ip_fw_eaction.c
sys/netpfil/ipfw/ip_fw_pfil.c
sys/netpfil/pf/pf_ioctl.c