OSDN Git Service

netfilter: conntrack: Flush connections with a given mark
authorKristian Evensen <kristian.evensen@gmail.com>
Wed, 24 Dec 2014 08:57:10 +0000 (09:57 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 8 Jan 2015 11:14:20 +0000 (12:14 +0100)
commit866476f323465a8afef10b14b48d5136bf5c51fe
tree62a766ab031b8621ee261f67c3ba220523ecf94c
parentb44b565cf548d78c1fa80321b14bf6b5308f337a
netfilter: conntrack: Flush connections with a given mark

This patch adds support for selective flushing of conntrack mappings.
By adding CTA_MARK and CTA_MARK_MASK to a delete-message, the mark (and
mask) is checked before a connection is deleted while flushing.

Configuring the flush is moved out of ctnetlink_del_conntrack(), and
instead of calling nf_conntrack_flush_report(), we always call
nf_ct_iterate_cleanup().  This enables us to only make one call from the
new ctnetlink_flush_conntrack() and makes it easy to add more filter
parameters.

Filtering is done in the ctnetlink_filter_match()-function, which is
also called from ctnetlink_dump_table(). ctnetlink_dump_filter has been
renamed ctnetlink_filter, to indicated that it is no longer only used
when dumping conntrack entries.

Moreover, reject mark filters with -EOPNOTSUPP if no ct mark support is
available.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_netlink.c