HomeFreeBSD

pf: rework pf_icmp_state_lookup() failure mode

Description

pf: rework pf_icmp_state_lookup() failure mode

If pf_icmp_state_lookup() finds a state but rejects it for not matching the
expected direction we should unlock the state (and NULL out *state). This
simplifies life for callers, and also ensures there's no confusion about what a
non-NULL returned state means.

Previously it could have been left in there by the caller, resulting in callers
unlocking the same state twice.

Approved by: so
Security: FreeBSD-EN-24:16.pf
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 0578fe492284ded4745167060be794032e6e22f0)
(cherry picked from commit d6e5f8643d37e925aa51fc8224cfc05aba0813f7)

Details

Provenance
kpAuthored on Aug 30 2024, 11:36 AM
markjCommitted on Sep 19 2024, 1:01 PM
Parents
rGaca9955aec8f: pf: be less strict about icmp state checking for sloppy state tracking
Branches
Unknown
Tags
Unknown