Page MenuHomeFreeBSD

pf: delay taking the rules lock in pf_test()
ClosedPublic

Authored by kp on Jul 15 2025, 3:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Feb 8, 12:45 AM
Unknown Object (File)
Fri, Jan 30, 3:32 AM
Unknown Object (File)
Dec 29 2025, 12:44 AM
Unknown Object (File)
Dec 20 2025, 5:16 PM
Unknown Object (File)
Dec 11 2025, 3:02 AM
Unknown Object (File)
Nov 25 2025, 4:11 PM
Unknown Object (File)
Nov 15 2025, 11:18 PM
Unknown Object (File)
Nov 9 2025, 6:04 AM

Details

Summary

We don't need the rules lock to protect the mbuf, or even the kif. If an
interface is removed (which is the only way for a kif to go away) we're not
going to receive traffic on it.

We can't delay taking the lock more, because pf_setup_pdesc() calls the
normalisation code, which iterates the scrub rules. If we ever get rid of those
(as OpenBSD has) it should be possible to delay taking the rules lock until we
actually need to iterate of the rules. That is, we might be able to avoid taking
it at all if we match an existing state.

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable