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, May 21, 4:30 AM
Unknown Object (File)
Mon, May 20, 3:20 AM
Unknown Object (File)
Mon, May 20, 12:46 AM
Unknown Object (File)
Sat, May 11, 11:36 PM
Unknown Object (File)
Wed, May 8, 7:03 AM
Unknown Object (File)
Feb 2 2024, 7:53 AM
Unknown Object (File)
Jan 29 2024, 1:53 PM
Unknown Object (File)
Jan 28 2024, 9:10 AM

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 Not Applicable
Unit
Tests Not Applicable