Skip to content

Commit 96b2ef9

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_tables: permit update of set size
Now that set->nelems is always updated permit update of the sets max size. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 78aa23d commit 96b2ef9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/net/netfilter/nf_tables.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,6 +1589,7 @@ struct nft_trans_set {
15891589
u64 timeout;
15901590
bool update;
15911591
bool bound;
1592+
u32 size;
15921593
};
15931594

15941595
#define nft_trans_set(trans) \
@@ -1603,6 +1604,8 @@ struct nft_trans_set {
16031604
(((struct nft_trans_set *)trans->data)->timeout)
16041605
#define nft_trans_set_gc_int(trans) \
16051606
(((struct nft_trans_set *)trans->data)->gc_int)
1607+
#define nft_trans_set_size(trans) \
1608+
(((struct nft_trans_set *)trans->data)->size)
16061609

16071610
struct nft_trans_chain {
16081611
bool update;

net/netfilter/nf_tables_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ static int __nft_trans_set_add(const struct nft_ctx *ctx, int msg_type,
483483
nft_trans_set_update(trans) = true;
484484
nft_trans_set_gc_int(trans) = desc->gc_int;
485485
nft_trans_set_timeout(trans) = desc->timeout;
486+
nft_trans_set_size(trans) = desc->size;
486487
}
487488
nft_trans_commit_list_add_tail(ctx->net, trans);
488489

@@ -9428,6 +9429,9 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
94289429

94299430
WRITE_ONCE(set->timeout, nft_trans_set_timeout(trans));
94309431
WRITE_ONCE(set->gc_int, nft_trans_set_gc_int(trans));
9432+
9433+
if (nft_trans_set_size(trans))
9434+
WRITE_ONCE(set->size, nft_trans_set_size(trans));
94319435
} else {
94329436
nft_clear(net, nft_trans_set(trans));
94339437
/* This avoids hitting -EBUSY when deleting the table

0 commit comments

Comments
 (0)