Skip to content

Commit 1b6345d

Browse files
committed
netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified
Since f3a2181 ("netfilter: nf_tables: Support for sets with multiple ranged fields"), it possible to combine intervals and concatenations. Later on, ef516e8 ("netfilter: nf_tables: reintroduce the NFT_SET_CONCAT flag") provides the NFT_SET_CONCAT flag for userspace to report that the set stores a concatenation. Make sure NFT_SET_CONCAT is set on if field_count is specified for consistency. Otherwise, if NFT_SET_CONCAT is specified with no field_count, bail out with EINVAL. Fixes: ef516e8 ("netfilter: nf_tables: reintroduce the NFT_SET_CONCAT flag") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent fc0ae52 commit 1b6345d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4451,6 +4451,11 @@ static int nf_tables_newset(struct sk_buff *skb, const struct nfnl_info *info,
44514451
err = nf_tables_set_desc_parse(&desc, nla[NFTA_SET_DESC]);
44524452
if (err < 0)
44534453
return err;
4454+
4455+
if (desc.field_count > 1 && !(flags & NFT_SET_CONCAT))
4456+
return -EINVAL;
4457+
} else if (flags & NFT_SET_CONCAT) {
4458+
return -EINVAL;
44544459
}
44554460

44564461
if (nla[NFTA_SET_EXPR] || nla[NFTA_SET_EXPRESSIONS])

0 commit comments

Comments
 (0)