Skip to contentSkip to conversation

netfilter: xtables: inclusion of xt_condition

PATCH Luciano Coelho 2 participants 6 messages Jul 16, 2010 netfilter

lore
Share & tools
lore
#0 lore raw

Hi Jan,

Quoted 6 lines · Jan Engelhardt
Quoted 2 lines · Patrick McHardy

This looks better, thanks. A few remaining questions about things I missed previously:

Will deal with it shortly.

Are you planning to resend this patch with the changes Patrick suggested?

As you may have seen in my earlier rfc email, I'm interested in something similar to the condition match. I'm not sure whether the best approach is to create a CONDITION target where we can set the condition variable in the iptables itself or if it is better to create a new "variable match" and an accompanying "VARIABLE target" that keeps the variables in memory, instead of using procfs.

Any suggestions?

Signature · 2 lines
Cheers,
Luca.
#1 lore raw
Quoted 10 lines · Luciano Coelho
Quoted 6 lines · Jan Engelhardt
Quoted 2 lines · Patrick McHardy

This looks better, thanks. A few remaining questions about things I missed previously:

Will deal with it shortly.

Are you planning to resend this patch with the changes Patrick suggested?

I can try.

Quoted 6 lines

As you may have seen in my earlier rfc email, I'm interested in something similar to the condition match. I'm not sure whether the best approach is to create a CONDITION target where we can set the condition variable in the iptables itself or if it is better to create a new "variable match" and an accompanying "VARIABLE target" that keeps the variables in memory, instead of using procfs.

procfs is in memory :)

#2 lore raw
Quoted 7 lines · ext Jan Engelhardt
Quoted 6 lines · Luciano Coelho
Quoted 5 lines · Jan Engelhardt
Quoted 2 lines · Patrick McHardy

This looks better, thanks. A few remaining questions about things I missed previously:

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Will deal with it shortly.

Are you planning to resend this patch with the changes Patrick suggested?

I can try.

Cool, thanks!

Quoted 8 lines
Quoted 6 lines

As you may have seen in my earlier rfc email, I'm interested in something similar to the condition match. I'm not sure whether the best approach is to create a CONDITION target where we can set the condition variable in the iptables itself or if it is better to create a new "variable match" and an accompanying "VARIABLE target" that keeps the variables in memory, instead of using procfs.

procfs is in memory :)

Yes, of course, but I meant without exporting it to procfs. ;) That would probably make the code a lot simpler (actually I can't imagine a simpler match/target than a "variable" match/target ;)

Signature · 2 lines
Cheers,
Luca.
#3 lore raw
Quoted 8 lines · Luciano Coelho
Quoted 8 lines
Quoted 7 lines

As you may have seen in my earlier rfc email, I'm interested in something similar to the condition match. I'm not sure whether the best approach is to create a CONDITION target where we can set the condition variable in the iptables itself or if it is better to create a new "variable match" and an accompanying "VARIABLE target" that keeps the variables in memory, instead of using procfs.

Quoted 5 lines
Quoted 1 line

procfs is in memory :)

Yes, of course, but I meant without exporting it to procfs. ;) That would probably make the code a lot simpler (actually I can't imagine a simpler match/target than a "variable" match/target ;)

Well, if not procfs, what should influence this anonymous variable? The weather? (No really, that came up at last NFWS. Using a userspace program, you can write into the procfs file and thus firewall based upon storm and thunder....)

#4 lore raw
Quoted 11 lines · ext Jan Engelhardt
Quoted 10 lines · Luciano Coelho
Quoted 9 lines
Quoted 7 lines

As you may have seen in my earlier rfc email, I'm interested in something similar to the condition match. I'm not sure whether the best approach is to create a CONDITION target where we can set the condition variable in the iptables itself or if it is better to create a new "variable match" and an accompanying "VARIABLE target" that keeps the variables in memory, instead of using procfs.

procfs is in memory :)

Quoted 8 lines
Quoted 3 lines

Yes, of course, but I meant without exporting it to procfs. ;) That would probably make the code a lot simpler (actually I can't imagine a simpler match/target than a "variable" match/target ;)

Well, if not procfs, what should influence this anonymous variable? The weather? (No really, that came up at last NFWS. Using a userspace program, you can write into the procfs file and thus firewall based upon storm and thunder....)

Heh! :)

What I need is a state variable that is set and read by netfilter tables. The idea is to have a state variable high_throughput that will be set to true (high) or false (low) depending on the rateest results. This would be used to prevent multiple NFLOG events for the same state (say, "HIGH") from being sent to userspace.

This is similar to what propose with the condition match:

Quoted 3 lines

With xt_condition that should not be a problem
(-A INPUT -m condition --name ruleXYZ -j NFLOG..)
This is settable through procfs.

But without depending on the userspace to change the condition value. I could have rules like this to change the condition:

-A INPUT -j throughput

-A above -m condition --name hi_thru -j RETURN
-A above -m rateest --rateest throughput --rateest-bps1 0bit --rateest-bps2 1000bit --rateest-gt -j NFLOG --nflog-prefix "HIGH" -A above -m rateest --rateest throughput --rateest-bps1 0bit --rateest-bps2 1000bit --rateest-gt -j CONDITION --name hi_thru --set 1

-A below -m condition ! --name hi_thru -j RETURN
-A below -m rateest --rateest throughput --rateest-bps1 0bit --rateest-bps2 1000bit --rateest-lt -j NFLOG --nflog-prefix "LOW" -A below -m rateest --rateest throughput --rateest-bps1 0bit --rateest-bps2 1000bit --rateest-lt -j CONDITION --name hi_thru --set 0

-A throughput -j RATEEST --rateest-name throughput --rateest-interval 250.0ms --rateest-ewmalog 500.0ms -A throughput -j above
-A throughput -j below

Signature · 2 lines
Cheers,
Luca.
#5 lore raw
Quoted 10 lines · Luciano Coelho
Quoted 9 lines
Quoted 4 lines

Yes, of course, but I meant without exporting it to procfs. ;) That would probably make the code a lot simpler (actually I can't imagine a simpler match/target than a "variable" match/target ;)

Well, if not procfs, what should influence this anonymous variable? The weather? (No really, that came up at last NFWS. Using a userspace program, you can write into the procfs file and thus firewall based upon storm and thunder....)

Quoted 7 lines

Heh! :)

What I need is a state variable that is set and read by netfilter tables. The idea is to have a state variable high_throughput that will be set to true (high) or false (low) depending on the rateest results. This would be used to prevent multiple NFLOG events for the same state (say, "HIGH") from being sent to userspace.

We have exactlt that -- the nfmark, accessible via -j MARK.