]> git.itanic.dy.fi Git - linux-stable/commit
netfilter: nf_tables: relax set/map validation checks
authorFlorian Westphal <fw@strlen.de>
Fri, 12 May 2023 12:19:47 +0000 (14:19 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 18 May 2023 06:48:54 +0000 (08:48 +0200)
commita4878eeae39048e6abe85891c714b49dc13fc08c
treeac0dfa0ca6247f2f6448b52f406135feef9c1491
parentb50a8b0d57ab1ef11492171e98a030f48682eac3
netfilter: nf_tables: relax set/map validation checks

Its currently not allowed to perform queries on a map, for example:

table t {
map m {
typeof ip saddr : meta mark
..

chain c {
ip saddr @m counter

will fail, because kernel requires that userspace provides a destination
register when the referenced set is a map.

However, internally there is no real distinction between sets and maps,
maps are just sets where each key is associated with a value.

Relax this so that maps can be used just like sets.

This allows to have rules that query if a given key exists
without making use of the associated value.

This also permits != checks which don't work for map lookups.

When no destination reg is given for a map, then permit this for named
maps.

Data and dump paths need to be updated to consider priv->dreg_set
instead of the 'set-is-a-map' check.

Checks in reduce and validate callbacks are not changed, this
can be relaxed later if a need arises.

Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nft_lookup.c