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, Aug 17, 6:29 PM
Unknown Object (File)
Sat, Aug 16, 7:17 AM
Unknown Object (File)
Wed, Aug 13, 6:05 AM
Unknown Object (File)
Jul 28 2025, 8:35 AM
Unknown Object (File)
Jul 28 2025, 5:28 AM
Unknown Object (File)
Jul 28 2025, 5:27 AM
Unknown Object (File)
Jul 28 2025, 4:49 AM
Unknown Object (File)
Jul 27 2025, 5:20 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