Skip to content

Commit 3f183a8

Browse files
author
Herton R. Krzesinski
committed
Merge: netfilter: nf_tables: honor set timeout and garbage collection updates
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1951 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2164485 Upstream Status: commit 123b996 Set timeout and garbage collection interval updates are ignored on updates, so its not possible to change the default timeout after set was created. Allow this for timeouts and gc interval, this avoids costly need for delete+re-add, esp. for sets with lots of entries. Signed-off-by: Florian Westphal <fwestpha@redhat.com> Approved-by: Xin Long <lxin@redhat.com> Approved-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 95f203b + e358654 commit 3f183a8

File tree

2 files changed

+199
-87
lines changed

2 files changed

+199
-87
lines changed

include/net/netfilter/nf_tables.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,29 @@ struct nft_set_iter {
281281
/**
282282
* struct nft_set_desc - description of set elements
283283
*
284+
* @ktype: key type
284285
* @klen: key length
286+
* @dtype: data type
285287
* @dlen: data length
288+
* @objtype: object type
289+
* @flags: flags
286290
* @size: number of set elements
291+
* @policy: set policy
292+
* @gc_int: garbage collector interval
287293
* @field_len: length of each field in concatenation, bytes
288294
* @field_count: number of concatenated fields in element
289295
* @expr: set must support for expressions
290296
*/
291297
struct nft_set_desc {
298+
u32 ktype;
292299
unsigned int klen;
300+
u32 dtype;
293301
unsigned int dlen;
302+
u32 objtype;
294303
unsigned int size;
304+
u32 policy;
305+
u32 gc_int;
306+
u64 timeout;
295307
u8 field_len[NFT_REG32_COUNT];
296308
u8 field_count;
297309
bool expr;
@@ -548,7 +560,9 @@ void *nft_set_catchall_gc(const struct nft_set *set);
548560

549561
static inline unsigned long nft_set_gc_interval(const struct nft_set *set)
550562
{
551-
return set->gc_int ? msecs_to_jiffies(set->gc_int) : HZ;
563+
u32 gc_int = READ_ONCE(set->gc_int);
564+
565+
return gc_int ? msecs_to_jiffies(gc_int) : HZ;
552566
}
553567

554568
/**
@@ -1501,6 +1515,9 @@ struct nft_trans_rule {
15011515
struct nft_trans_set {
15021516
struct nft_set *set;
15031517
u32 set_id;
1518+
u32 gc_int;
1519+
u64 timeout;
1520+
bool update;
15041521
bool bound;
15051522
};
15061523

@@ -1510,6 +1527,12 @@ struct nft_trans_set {
15101527
(((struct nft_trans_set *)trans->data)->set_id)
15111528
#define nft_trans_set_bound(trans) \
15121529
(((struct nft_trans_set *)trans->data)->bound)
1530+
#define nft_trans_set_update(trans) \
1531+
(((struct nft_trans_set *)trans->data)->update)
1532+
#define nft_trans_set_timeout(trans) \
1533+
(((struct nft_trans_set *)trans->data)->timeout)
1534+
#define nft_trans_set_gc_int(trans) \
1535+
(((struct nft_trans_set *)trans->data)->gc_int)
15131536

15141537
struct nft_trans_chain {
15151538
bool update;

0 commit comments

Comments
 (0)