fw4: flushes entire nft ruleset when stopped, but only flushes fw4 table on restart
Describe the bug
service firewall restart flushes the fw4 table (and all chains and rules within) as expected.
But:
service firewall stop flushes the entire nft ruleset, even tables not belonging to fw4.
So doing
service firewall restart
has a very different effect to doing
service firewall stop
service firewall startThis would go unnoticed if the only rules in the nft ruleset were those of fw4, but can be catastrophic if other packages have their own nft tables, possibly resulting in a soft brick of the router.
Tested on Gl-inet mt300mt-v2, and on numerous other devices/targets giving the same result.
OpenWrt version
r19803-9a599fee93
OpenWrt target/subtarget
ramips/mt76x8
Device
Gl-inet mt300mt-v2, but also tested on numerous devices/targets giving the same result
Image kind
Official downloaded image
Steps to reproduce
First, list tables:
root@OpenWrt:~# nft list tables
table inet fw4
root@OpenWrt:~#Now add a new table:
root@OpenWrt:~# nft add table inet test
root@OpenWrt:~# nft list tables
table inet fw4
table inet test
root@OpenWrt:~#Restart fw4:
root@OpenWrt:~# service firewall restart
root@OpenWrt:~# nft list tables
table inet fw4
table inet test
root@OpenWrt:~#Stop fw4:
root@OpenWrt:~# service firewall stop
root@OpenWrt:~# nft list tables
root@OpenWrt:~#All tables have gone...
Start fw4:
root@OpenWrt:~# service firewall start
root@OpenWrt:~# nft list tables
table inet fw4
root@OpenWrt:~# Only the fw4 table remains, our test table has gone.
Actual behaviour
As shown in Steps to Reproduce.
Expected behaviour
fw4 should not flush and delete tables created by other packages or by manual creation Restart and Stop/Start should have the same effect.
Additional info
No response
Diffconfig
No response
Terms
- I am reporting an issue for OpenWrt, not an unsupported fork.
Source: openwrt/openwrt