]> git.ipfire.org Git - thirdparty/nftables.git/commit
evaluate: simplify set to list normalisation for device expressions
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 21 Aug 2025 09:17:40 +0000 (11:17 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 27 Aug 2025 22:26:55 +0000 (00:26 +0200)
commit3c9486b2af430a19495f0bc7a3794260a67241e7
tree90f60342acc5996f3bdaccd190df876802814065
parent65ac6c27886580519e5c7509f82ec1182dd11696
evaluate: simplify set to list normalisation for device expressions

When evaluating the list of devices, two expressions are possible:

- EXPR_LIST, which is the expected expression type to store the list of
  chain/flowtable devices.

- EXPR_SET, in case that a variable is used to express the device list.
  This is because it is not possible to know if the variable defines
  set elements or devices. Since sets are more common, EXPR_SET is used.

In the latter case, this list expressed as EXPR_SET gets translated to
EXPR_LIST. Before such translation, the EXPR_VARIABLE is evaluated,
therefore all variables are gone and only EXPR_SET_ELEM are possible in
expr_set_to_list().

Remove the EXPR_VALUE and EXPR_VARIABLE cases in expr_set_to_list()
since those are never seen. Add BUG() in case any other expressions than
EXPR_SET_ELEM is seen.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c