]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: ensure chain policy evaluation when specified
authorPablo Neira Ayuso <pablo@netfilter.org>
Sun, 17 Aug 2025 19:01:30 +0000 (21:01 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 19 Aug 2025 12:53:57 +0000 (14:53 +0200)
commit01277922fede9fef8aacf5cc871bfbd55bbd78ef
treea39a2f7f4690a0eca283141b143cdb7c2012d658
parentc44995e31ba60c4823bb81fecd29020452b9e702
src: ensure chain policy evaluation when specified

Set on CHAIN_F_BASECHAIN when policy is specified in chain, otherwise
chain priority is not evaluated.

Toggling this flag requires needs three adjustments to work though:

1) chain_evaluate() needs skip evaluation of hook name and priority if
   not specified to allow for updating the default chain policy, e.g.

chain ip x y { policy accept; }

2) update netlink bytecode generation for chain to skip NFTA_CHAIN_HOOK
   so update path is exercised in the kernel.

3) error reporting needs to check if basechain priority and type is
   set on, otherwise skip further hints.

Fixes: acdfae9c3126 ("src: allow to specify the default policy for base chains")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/cmd.c
src/evaluate.c
src/mnl.c
src/parser_bison.y
tests/shell/testcases/bogons/nft-f/basechain_bad_policy [new file with mode: 0644]
tests/shell/testcases/bogons/nft-f/unexisting_chain_set_policy [new file with mode: 0644]