Page MenuHomeFreeBSD

ipfw: create a bpf tap point for every log rule
ClosedPublic

Authored by glebius on Nov 21 2025, 10:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 9, 7:10 AM
Unknown Object (File)
Fri, Jan 9, 5:32 AM
Unknown Object (File)
Thu, Jan 1, 6:26 AM
Unknown Object (File)
Sat, Dec 27, 9:38 PM
Unknown Object (File)
Fri, Dec 26, 11:21 PM
Unknown Object (File)
Sun, Dec 21, 9:33 PM
Unknown Object (File)
Sun, Dec 21, 2:05 PM
Unknown Object (File)
Dec 1 2025, 5:41 PM

Details

Summary

Dynamically allocate bpf tap points for every rule that has "log".
The name is "ipfw%u", where %u is substituted to the rule number.
The default catch all "ipfw0" tap still exists for compatibility
and it will catch packets in case if there are no bpf listeners
on a per-rule tap.

Diff Detail

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

Event Timeline

sys/netpfil/ipfw/ip_fw_bpf.c
62

Currently we support IPFW_DEFAULT_RULE larger than 64k.

93

D53872 says that it is consumer's responsibility to avoid duplicates. But you can create many rules with the same rulenum and it seems there isn't any checks related to duplicates prior to bpf_attach.

sys/netpfil/ipfw/ip_fw_bpf.c
62

Я же два раза спрашивал про 32-битные номера и не получил ответа! >:-|

So, how exactly can I create rule numbers larger than 64k? The constant is hardcoded, it is not a kernel option. If you explain me the mechanism I will look into expanding this string or maybe allocating it dynamically.

93

I totally missed that multiple rules can have one number. I will update the diff to cover that. Thanks!

  • Address the fact that many rules can have the same number.
  • Support 32-bit rule numbers.
This revision is now accepted and ready to land.Dec 10 2025, 4:41 PM
  • Documentation and ipfw(8) update.
This revision now requires review to proceed.Dec 10 2025, 8:38 PM
This revision was not accepted when it landed; it landed in state Needs Review.Mon, Dec 15, 9:47 PM
This revision was automatically updated to reflect the committed changes.