HomeFreeBSD

pf: ensure states passed to pf_free_state() are always unlinked

Description

pf: ensure states passed to pf_free_state() are always unlinked

In pf_create_state() we can end up deleting the state immediately. This
can happen if we fail to map the relevant addresses or fail
normalization or fail to insert it into the state table.
If that happens we delete the state again with pf_free_state(). However,
this asserts that the state must be unlinked.

It's correct to simply set the state to PFTM_UNLINKED because we've not
yet linked it.

Submitted by: Mateusz Guzik <mjg@FreeBSD.org>
Reviewed by: scottl
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31752

Details

Provenance
kpAuthored on Sep 3 2021, 7:36 AM
Reviewer
scottl
Differential Revision
D31752: pf: ensure states passed to pf_free_state() are always unlinked
Parents
rG71611b0c6885: tcp: document TCP Fast Open (RFC 7413) in tcp(4)
Branches
Unknown
Tags
Unknown