Dump mark even if event is a DESTROY event
Subsystems (2)
PATCH 1/1 Dump mark even if event is a DESTROY event
Hi,
Mark is scarcely dump by nfnetlink_conntrack event handler. As it can be used to test that a connection is part of a given subset, I think it should be almost always dumped.
The attached patch implements this behaviour.
BR,
Signature · 3 lines
Éric Leblond, [email protected] Téléphone : 01 44 89 46 39, Fax : 01 44 89 45 01 INL, http://www.inl.fr
--- net/netfilter/nf_conntrack_netlink.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
net/netfilter/nf_conntrack_netlink.c +6 -6
@@ -389,17 +389,17 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, && ctnetlink_dump_helpinfo(skb, ct) < 0) goto nfattr_failure; -#ifdef CONFIG_NF_CONNTRACK_MARK -if ((events &IPCT_MARK || ct->mark) - &&ctnetlink_dump_mark (skb, ct) <0 ) - goto nfattr_failure; -#endif -if (events &IPCT_COUNTER_FILLING && (ctnetlink_dump_counters (skb, ct,IP_CT_DIR_ORIGINAL ) <0 ||ctnetlink_dump_counters (skb, ct,IP_CT_DIR_REPLY ) <0 )) goto nfattr_failure; } + +#ifdef CONFIG_NF_CONNTRACK_MARK +if ((events &IPCT_MARK || ct->mark) + &&ctnetlink_dump_mark (skb, ct) <0 ) + goto nfattr_failure; +#endif nlh->nlmsg_len = skb->tail - b;nfnetlink_send (skb,0 , group,0 );
Signature · 1 line
1.4.4.3
Pablo Neira Ayuso
maintainerHi Eric,
Quoted 3 lines · Eric Leblond
Mark is scarcely dump by
nfnetlink_conntrackevent handler. As it can be used to test that a connection is part of a given subset, I think it should be almost always dumped.
I don't see why you may need the mark in the destroy message. You can keep a cache in userspace with the connections that belong to a certain subset and their marks, then if the mark changes, move such connection the a different subset. It doesn't make sense to me the idea of including the mark in the destroy message since such mark didn't change with regards to the previous event delivered.
Signature · 1 line
The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
Hi,
Quoted 8 lines · Pablo Neira Ayuso
Hi Eric,
I don't see why you may need the mark in the destroy message. You can keep a cache in userspace with the connections that belong to a certain subset and their marks, then if the mark changes, move such connection the a different subset. It doesn't make sense to me the idea of including the mark in the destroy message since such mark didn't change with regards to the previous event delivered.
I do not agree with the idea of having a cache in userspace. It has been coded in kernel and for this kind of stuff, once is enough. I really want to avoid all synchronisation problems we could have to do this in userspace.
Furthermore, mark exists to be able to create subset for other tools like tc or ip.
BR,
Signature · 3 lines
Éric Leblond, [email protected] Téléphone : 01 44 89 46 39, Fax : 01 44 89 45 01 INL, http://www.inl.fr
* Eric Leblond wrote, On 21/02/07 13:13:
Quoted 12 lines
Hi,
Quoted 8 lines · Pablo Neira Ayuso
Hi Eric,
I don't see why you may need the mark in the destroy message. You can keep a cache in userspace with the connections that belong to a certain subset and their marks, then if the mark changes, move such connection the a different subset. It doesn't make sense to me the idea of including the mark in the destroy message since such mark didn't change with regards to the previous event delivered.
Quoted 7 lines
I do not agree with the idea of having a cache in userspace. It has been coded in kernel and for this kind of stuff, once is enough. I really want to avoid all synchronisation problems we could have to do this in userspace.
Furthermore, mark exists to be able to create subset for other tools like tc or ip.
I'm with Eric. I'm already using a patch like his.
Why keep a cache in user-space when there is already a cache in kernel-space?
There are two clear choices; the old ulogd that keeps a full cache in user space and receives every packet over netlink; or conntrack that keeps a whole cache in kernel-space, updates counters in kernel space and only sends significant updates over netlink.
To replicate the whole conntrack hash in user-space to avoid sending a couple of bytes over netlink on connection-destroy is to seek after some kind of optimization that I don't rightly understand.
Sam