Page MenuHomeFreeBSD

ipfw: create a bpf tap point for every log rule
Needs ReviewPublic

Authored by glebius on Fri, Nov 21, 10:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 1, 5:41 PM
Unknown Object (File)
Sun, Nov 30, 1:30 PM
Unknown Object (File)
Sat, Nov 29, 12:08 AM
Unknown Object (File)
Thu, Nov 27, 11:43 PM
Unknown Object (File)
Tue, Nov 25, 1:27 PM
Unknown Object (File)
Sat, Nov 22, 11:04 AM
Unknown Object (File)
Sat, Nov 22, 4:30 AM
Unknown Object (File)
Sat, Nov 22, 3:23 AM

Details

Reviewers
ae
lytboris_gmail.com
Group Reviewers
network
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 69165
Build 66048: arc lint + arc unit

Event Timeline

sys/netpfil/ipfw/ip_fw_bpf.c
61

Currently we support IPFW_DEFAULT_RULE larger than 64k.

92

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
61

Я же два раза спрашивал про 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.

92

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.Wed, Dec 10, 4:41 PM
  • Documentation and ipfw(8) update.
This revision now requires review to proceed.Wed, Dec 10, 8:38 PM