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

Details

Provenance
markjAuthored on Thu, Jan 16, 3:44 PM
Differential Revision
D47953: pf: Force logging if pf_create_state() fails
Parents
rGc1557708f1fa: pkg: Fix Coverity warnings
Branches
Unknown
Tags
Unknown