aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2015-04-05 08:41:06 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2015-04-08 10:58:27 -0400
commit3dd0673ac3cd7d05cde103396ec7ec410a901de2 (patch)
tree4daf53c5aef7eade635652cd37c023fbd4e75bc1 /include/net
parent4a8678efbec6b0ea46baafb77cd297e6e02da933 (diff)
netfilter: nf_tables: prepare set element accounting for async updates
Use atomic operations for the element count to avoid races with async updates. To properly handle the transactional semantics during netlink updates, deleted but not yet committed elements are accounted for seperately and are treated as being already removed. This means for the duration of a netlink transaction, the limit might be exceeded by the amount of elements deleted. Set implementations must be prepared to handle this. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/netfilter/nf_tables.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index a785699329c9..746423332fcb 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -258,6 +258,7 @@ void nft_unregister_set(struct nft_set_ops *ops);
258 * @dtype: data type (verdict or numeric type defined by userspace) 258 * @dtype: data type (verdict or numeric type defined by userspace)
259 * @size: maximum set size 259 * @size: maximum set size
260 * @nelems: number of elements 260 * @nelems: number of elements
261 * @ndeact: number of deactivated elements queued for removal
261 * @timeout: default timeout value in msecs 262 * @timeout: default timeout value in msecs
262 * @gc_int: garbage collection interval in msecs 263 * @gc_int: garbage collection interval in msecs
263 * @policy: set parameterization (see enum nft_set_policies) 264 * @policy: set parameterization (see enum nft_set_policies)
@@ -275,7 +276,8 @@ struct nft_set {
275 u32 ktype; 276 u32 ktype;
276 u32 dtype; 277 u32 dtype;
277 u32 size; 278 u32 size;
278 u32 nelems; 279 atomic_t nelems;
280 u32 ndeact;
279 u64 timeout; 281 u64 timeout;
280 u32 gc_int; 282 u32 gc_int;
281 u16 policy; 283 u16 policy;