Private data structure for each iptables rule using
Hello folks
I am writing a individual netfilter module currently currently. I am encountering a problem that is how can I keep a private data structure for each
iptables rule in each connection.
For example
I have such kind rules in the iptables rule-set
iptables -A FORWARD -m mymodule --seq1 -j DROP
iptables -A FORWARD -m mymodule --seq2 -j DROP
Iptables -A FORWARD -m mymodule --seq3 -j DROP
When packets traverses the first rule, I want to keep some private data in the connection tracking data structure.
But I think these private data are possible modified by the later "mymodule" rules.
So
1. Can I have a private data structure for each iptables rule using ?
2. Any suggestion to prevent different rule modify the same data structure of connection tracking? Thanks in advance..
Vincent
Quoted 4 lines
I am writing a individual netfilter module currently currently. I am encountering a problem that is how can I keep a private data structure for each
iptables rule in each connection.
What would that be used for?
Quoted 4 lines
When packets traverses the first rule, I want to keep some private data in the connection tracking data structure.
But I think these private data are possible modified by the later "mymodule" rules.
Only if you code them to do such modification.
Quoted 2 lines
2. Any suggestion to prevent different rule modify the same data structure of connection tracking?
A) What is it that would identify individual rules?
B) How do you add _any_ information to connection tracking?
If you can answer both questions precisely, keep a linked list of per-rule nodes, with the head pointer in the connection tracking entry, and every node storing which rule it belongs to.
Answering B) should be easy. A) is the tricky part. Think about occasional modifications to the rulesets, and what should happen to the then-current connection tracking stuff...
best regards
Patrick