HomeFreeBSD

pf: Force logging if pf_create_state() fails

Description

pf: Force logging if pf_create_state() fails

Currently packets are logged before pf_create_state() is called, so we
might log a packet as passed that is subsequently dropped due to state
creation failure. In particular, the drop is not logged, which is
wrong.

Improve the situation a bit: force logging if state creation fails.
This isn't totally right as we'll end up logging the packet twice in
this case, but it's better than not logging the drop at all.

Add a regression test.

Discussed with: kp, ks
Co-authored-by: Franco Fichtner <franco@opnsense.org>
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: OPNsense
Differential Revision: https://reviews.freebsd.org/D47953

(cherry picked from commit 886396f1b1a727c642071965612e2c2c9dd11d6c)

Details

Provenance
markjAuthored on Thu, Jan 16, 3:44 PM
Differential Revision
D47953: pf: Force logging if pf_create_state() fails
Parents
rGd45326bfeab7: hwpstate_amd: add amd pstate for zen5
Branches
Unknown
Tags
Unknown