Page MenuHomeFreeBSD

pfil: PFIL_PASS never frees the mbuf
ClosedPublic

Authored by kp on Jan 26 2024, 2:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 12, 5:38 PM
Unknown Object (File)
Sun, Aug 3, 1:28 AM
Unknown Object (File)
Thu, Jul 24, 7:49 AM
Unknown Object (File)
Thu, Jul 24, 6:38 AM
Unknown Object (File)
Tue, Jul 22, 11:35 AM
Unknown Object (File)
Thu, Jul 17, 8:52 PM
Unknown Object (File)
Jul 11 2025, 6:48 AM
Unknown Object (File)
Jul 7 2025, 4:59 PM

Details

Summary

pfil hooks (i.e. firewalls) may pass, modify or free the mbuf passed
to them. (E.g. when rejecting a packet, or when gathering up packets
for reassembly).

If the hook returns PFIL_PASS the mbuf must still be present. Assert
this in pfil_mem_common() and ensure that ipfilter follows this
convention. pf and ipfw already did.
Similarly, if the hook returns PFIL_DROPPED or PFIL_CONSUMED the mbuf
must have been freed (or now be owned by the firewall for further
processing, like packet scheduling or reassembly).

This allows us to remove a few extraneous NULL checks.

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 55641
Build 52530: arc lint + arc unit