Skip to content

Commit 97c976d

Browse files
committed
netfilter: nftables: add helper function to validate set element data
When binding sets to rule, validate set element data according to set definition. This patch adds a helper function to be reused by the catch-all set element support. Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent e6ba7cb commit 97c976d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4499,10 +4499,9 @@ static int nft_validate_register_store(const struct nft_ctx *ctx,
44994499
enum nft_data_types type,
45004500
unsigned int len);
45014501

4502-
static int nf_tables_bind_check_setelem(const struct nft_ctx *ctx,
4503-
struct nft_set *set,
4504-
const struct nft_set_iter *iter,
4505-
struct nft_set_elem *elem)
4502+
static int nft_setelem_data_validate(const struct nft_ctx *ctx,
4503+
struct nft_set *set,
4504+
struct nft_set_elem *elem)
45064505
{
45074506
const struct nft_set_ext *ext = nft_set_elem_ext(set, elem->priv);
45084507
enum nft_registers dreg;
@@ -4514,6 +4513,14 @@ static int nf_tables_bind_check_setelem(const struct nft_ctx *ctx,
45144513
set->dlen);
45154514
}
45164515

4516+
static int nf_tables_bind_check_setelem(const struct nft_ctx *ctx,
4517+
struct nft_set *set,
4518+
const struct nft_set_iter *iter,
4519+
struct nft_set_elem *elem)
4520+
{
4521+
return nft_setelem_data_validate(ctx, set, elem);
4522+
}
4523+
45174524
int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
45184525
struct nft_set_binding *binding)
45194526
{

0 commit comments

Comments
 (0)