netfilter: nf_tables: honor set timeout and garbage collection updates
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH v6 4/4 netfilter: nf_tables: honor set timeout and garbage collection updates
Set timeout and garbage collection interval updates are ignored on updates. Add transaction to update global set element timeout and garbage collection interval.
Fixes 96518518cc41 ("netfilter: add nftables")
Suggested-by Florian Westphal <[email protected]>
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
v6: missing check for set updates in abort path, simply discard the transaction.
include/net/netfilter/nf_tables.h | 13 ++++++- net/netfilter/nf_tables_api.c | 63 ++++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 19 deletions(-)
include/net/netfilter/nf_tables.h +12 -1
@@ -597,7 +597,9 @@ void *nft_set_catchall_gc(const struct nft_set *set);static inline unsigned long nft_set_gc_interval (const struct nft_set *set) { -return set->gc_int ?msecs_to_jiffies (set->gc_int) :HZ ; +u32 gc_int =READ_ONCE (set->gc_int); + +return gc_int ?msecs_to_jiffies (gc_int) :HZ ; }/**
@@ -1570,6 +1572,9 @@ struct nft_trans_rule {struct nft_trans_set {struct nft_set *set;u32 set_id; +u32 gc_int; +u64 timeout; +bool update;bool bound; };
@@ -1579,6 +1584,12 @@ struct nft_trans_set { (((struct nft_trans_set *)trans->data)->set_id)#define nft_trans_set_bound (trans) \ (((struct nft_trans_set *)trans->data)->bound) +#define nft_trans_set_update (trans) \ + (((struct nft_trans_set *)trans->data)->update) +#define nft_trans_set_timeout (trans) \ + (((struct nft_trans_set *)trans->data)->timeout) +#define nft_trans_set_gc_int (trans) \ + (((struct nft_trans_set *)trans->data)->gc_int)struct nft_trans_chain {bool update;
net/netfilter/nf_tables_api.c +45 -18
132 lines not on this page · raw message
Signature · 1 line
2.30.2