HomeFreeBSD

pf: convert state retrieval to netlink

Description

pf: convert state retrieval to netlink

Use netlink to export pf's state table.

The primary motivation is to improve how we deal with very large state
stables. With the previous implementation we had to build the entire
list (both in the kernel and in userspace) before we could start
processing. With netlink we start to get data in userspace while the
kernel is still generating more. This reduces peak memory consumption
(which can get to the GB range once we hit millions of states).

Netlink also makes future extension easier, in that we can easily add
fields to the state export without breaking userspace. In that regard
it's similar to an nvlist-based approach, except that it also deals
with transport to userspace and that it performs significantly better
than nvlists. Testing has failed to measure a performance difference
between the previous struct-copy based ioctl and the netlink approach.

Differential Revision: https://reviews.freebsd.org/D38888

Details

Provenance
melifaroAuthored on Sep 15 2023, 10:06 AM
kpCommitted on Oct 10 2023, 9:48 AM
Differential Revision
D38888: pf: add sample netlink interface
Parents
rG5bdd74cc05e6: linux(4): Drop the outdated comments about sixth register on i386 int0x80
Branches
Unknown
Tags
Unknown