Add action to "finally" accept packets?
OpenWrt switched to nftables in its firewall4 implementation [0]. Now people start porting their custom iptables rules to nft. However, there is a lack of "finally" accepting a packet without traversing the other chains with the same hook type and later priority in the same table [1,2]. Jumping/GoTo statements do not help [3]. Is it possible to add an action/policy allowing us to stop traversing the table?
[0] - https://git.openwrt.org/project/firewall4.git
[1] - https://github.com/openwrt/openwrt/issues/9981
[2] - https://wiki.nftables.org/wiki-nftables/index.php/Configuring_chains
[3] - https://wiki.nftables.org/wiki-nftables/index.php/Jumping_to_chain
Florian Westphal
maintainerQuoted 9 lines · Nick
OpenWrt switched to nftables in its firewall4 implementation [0]. Now people start porting their custom iptables rules to nft. However, there is a lack of "finally" accepting a packet without traversing the other chains with the same hook type and later priority in the same table [1,2]. Jumping/GoTo statements do not help [3]. Is it possible to add an action/policy allowing us to stop traversing the table?
[0] - https://git.openwrt.org/project/firewall4.git
[1] - https://github.com/openwrt/openwrt/issues/9981
This statement is incorrect, nft behaves like iptables. ACCEPT in raw table moves packet to mangle table, and so on.
The confusion arises because users that to add their own tables, and then are surprised that their 'accept' "does not work" the way they expect.
Its not possible to implement a 'full accept' because it would also make the packet skip the internal hooks that are used e.g. by conntrack.
Why does jump/goto not help? It works just like in iptables.
Quoted 1 line
Why does jump/goto not help? It works just like in iptables.
It does not help because of the way firewall4 is including custom nftables chains for now. You need to add a hook yourself.
Firewall4 has a table called fw4, there they also hook e.g. to the priority filter. Basically, your custom chain needs to hook filter priority - 1 to be executed and whatever you do, the fw4 hook will be executed afterward. I wanted to "go" over it. As I understand the current discussion, the plan is to hook "only once" and allow to jump to the custom chains from there. Please keep in mind, that I am not the author of firewall4. I just wanted to ask if something like this is or will be possible in the future. I did not find any information about it on the internet. Thanks for your answer.