diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2011-02-01 10:06:30 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-02-01 10:06:30 -0500 |
commit | 3db7e93d3308fb882884b9f024235d6fbf542034 (patch) | |
tree | 6488a45704107f77645774c85d67511b7a73fed1 /net | |
parent | 9d0db8b6b1da9e3d4c696ef29449700c58d589db (diff) |
netfilter: ecache: always set events bits, filter them later
For the following rule:
iptables -I PREROUTING -t raw -j CT --ctevents assured
The event delivered looks like the following:
[UPDATE] tcp 6 src=192.168.0.2 dst=192.168.1.2 sport=37041 dport=80 src=192.168.1.2 dst=192.168.1.100 sport=80 dport=37041 [ASSURED]
Note that the TCP protocol state is not included. For that reason
the CT event filtering is not very useful for conntrackd.
To resolve this issue, instead of conditionally setting the CT events
bits based on the ctmask, we always set them and perform the filtering
in the late stage, just before the delivery.
Thus, the event delivered looks like the following:
[UPDATE] tcp 6 432000 ESTABLISHED src=192.168.0.2 dst=192.168.1.2 sport=37041 dport=80 src=192.168.1.2 dst=192.168.1.100 sport=80 dport=37041 [ASSURED]
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_conntrack_ecache.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c index 5702de35e2bb..63a1b915a7e4 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c | |||
@@ -63,6 +63,9 @@ void nf_ct_deliver_cached_events(struct nf_conn *ct) | |||
63 | * this does not harm and it happens very rarely. */ | 63 | * this does not harm and it happens very rarely. */ |
64 | unsigned long missed = e->missed; | 64 | unsigned long missed = e->missed; |
65 | 65 | ||
66 | if (!((events | missed) & e->ctmask)) | ||
67 | goto out_unlock; | ||
68 | |||
66 | ret = notify->fcn(events | missed, &item); | 69 | ret = notify->fcn(events | missed, &item); |
67 | if (unlikely(ret < 0 || missed)) { | 70 | if (unlikely(ret < 0 || missed)) { |
68 | spin_lock_bh(&ct->lock); | 71 | spin_lock_bh(&ct->lock); |