Skip to contentSkip to conversation

kernel rule insertion question/suggestion

DISCUSSION Patrascu Eugeniu 2 participants 2 messages Jan 6, 2004 – Jan 7, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

As explained by a list member a while ago, to insert a netfilter rule in the running kernel the following things happen:
I. the whole ruleset is being downloaded in userspace
II. the rules are checked for loops/errors/whatever and the new rule is
added to the chain.
III. then the whole ruleset is uploaded back into the running kernel. IV. the steps above are repeated for each and every rule added.

I was wondering (in case what I wrote above is really true) if there would be a good ideea to have a userspace rule compiler that can check for errors in the rules and then just upload them in the kernel, without using the mecanism described above. this would be useful for compiling firewall rules on a central machine and after that just deploying them thru out the network; also, this would be very helpful for people who have slow machines as firewalls.

PS: I apologize for my writing, but english is not my native language.

Signature · 1 line
Patrascu Eugeniu <[email protected]>
#1 lore raw
Quoted 9 lines · Patrascu Eugeniu

Hi,

As explained by a list member a while ago, to insert a netfilter rule in the running kernel the following things happen:
I. the whole ruleset is being downloaded in userspace
II. the rules are checked for loops/errors/whatever and the new rule is
added to the chain.
III. then the whole ruleset is uploaded back into the running kernel. IV. the steps above are repeated for each and every rule added.

If you want to avoid this then use iptables-restore to load your ruleset. This compiles the ruleset and if successful installs it with one call to the kernel.

Quoted 4 lines

I was wondering (in case what I wrote above is really true) if there would be a good ideea to have a userspace rule compiler that can check for errors in the rules and then just upload them in the kernel, without using the mecanism described above.

Having a "dry-run" iptables-restore type command would perhaps be useful to verify the syntax of a ruleset.

Regards
Henrik