Page MenuHomeFreeBSD

ng_ipfw: provide a tree for faster hook lookup
ClosedPublic

Authored by glebius on Jul 29 2026, 10:46 PM.
Tags
None
Referenced Files
F168823732: D58547.diff
Sun, Aug 30, 8:03 AM
Unknown Object (File)
Sat, Aug 29, 11:10 PM
Unknown Object (File)
Sat, Aug 29, 5:30 AM
Unknown Object (File)
Wed, Aug 19, 10:04 PM
Unknown Object (File)
Sun, Aug 16, 11:17 PM
Unknown Object (File)
Sun, Aug 16, 9:56 PM
Unknown Object (File)
Sun, Aug 16, 9:37 PM
Unknown Object (File)
Sun, Aug 16, 5:57 AM

Details

Summary

This should assist setups that connect a lot of nodes to ipfw: and then
distribute traffic with ipfw(4) tablearg feature.

Diff Detail

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

Event Timeline

pouria added a subscriber: pouria.

Nice work!
LGTM, but it would be nice to have an example of how to use this module.

The manual only says:

This node type supports only the generic control messages

which isn't very helpful. For example:

# ngctl list
There are 2 total nodes:
Name: ipfw            Type: ipfw            ID: 00000001   Num hooks: 0
...
[root@ftsr1] [~] # ipfw list
00040 ngtee 123 ip from any to any
...

Then what?
How do you tell ng_ipfw which cookie it should work on? Should you do that at all?
Of course, this is my issue and it's not related this revision.
I don’t know how to use it, so new users probably won't either.

This revision is now accepted and ready to land.Jul 30 2026, 2:38 PM

This patch is wonderful! When I try to migrate from dummy net shaper to ng_car on my IPOE server I faced problem that if I have a lot of CAR nodes and start to transmit even small traffic - I see CPU peak about 50-60%. It's was terrible! Good for me that I asked Glebius about it and he made this patch. Now CPU load about 1-2% with 500m policed traffic and this is GREAT! Thanks a lot Glebius!

For example:

# ngctl list
There are 2 total nodes:
Name: ipfw            Type: ipfw            ID: 00000001   Num hooks: 0
...
[root@ftsr1] [~] # ipfw list
00040 ngtee 123 ip from any to any
...

Then what?

Then if you connect anything to "ipfw:123" you will receive traffic. For example nghook ipfw: 123.

I don’t know how to use it, so new users probably won't either.

Looks like people with general knowledge of netgraph are able to pick up the usage from the existing manual page. Of course I'm not saying that the page is final and can't be improved. If anybody wants to improve it - welcome.