fw4: fix handling the ipset "comment" option
authorJo-Philipp Wich <jo@mein.io>
Sat, 7 Jan 2023 16:00:18 +0000 (17:00 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 3 Feb 2023 11:04:15 +0000 (12:04 +0100)
commit39e8c70957c795bf0c12f04299170ae86c6efdf8
tree80a5fd67851293cba44364fbe87935eaaff2b01d
parent700a925fd9c1f1ff404e6b125cd5347ad7c45668
fw4: fix handling the ipset "comment" option

The comment option for ipset definitions is incorrectly declared as bool
and not actually used anywhere in the nftables output rendering.

Solve this issue by changing it to the proper "string" type and expose
the user configured comment as "comment" property in the generated nftables
output.

Also add some initial test coverage for ipset declarations to better spot
such inconsistencies in the future.

Ref: https://github.com/openwrt/luci/pull/6187#issuecomment-1374506633
Reported-by: Paul Dee <itsascambutmailmeanyway@gmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
15 files changed:
root/usr/share/firewall4/templates/mangle-rule.uc [new file with mode: 0644]
root/usr/share/firewall4/templates/ruleset.uc
root/usr/share/firewall4/templates/ruleset.uc.orig [new file with mode: 0644]
root/usr/share/firewall4/templates/ruleset.uc.rej [new file with mode: 0644]
root/usr/share/ucode/fw4.uc
tests/05_includes/01_nft_includes [deleted file]
tests/05_includes/02_firewall.user_include [deleted file]
tests/05_includes/03_script_includes [deleted file]
tests/05_includes/04_disabled_include [deleted file]
tests/05_ipsets/01_declaration [new file with mode: 0644]
tests/05_ipsets/02_usage [new file with mode: 0644]
tests/06_includes/01_nft_includes [new file with mode: 0644]
tests/06_includes/02_firewall.user_include [new file with mode: 0644]
tests/06_includes/03_script_includes [new file with mode: 0644]
tests/06_includes/04_disabled_include [new file with mode: 0644]