fw4: substitute double quotes in strings master
authorJo-Philipp Wich <jo@mein.io>
Tue, 21 May 2024 06:54:02 +0000 (08:54 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 21 May 2024 06:54:02 +0000 (08:54 +0200)
commit4c01d1ebf99e8ecfa69758a9b4f450ecef7b93cd
treeecee36e2908c3072d4d681ca250ce15e69fa8fe1
parent698a53354fd280aae097efe08803c0c9a10c14c2
fw4: substitute double quotes in strings

The nftables parser has no concept of escape characters in quoted strings,
nor does it support alternative quoting styles so it is currently
impossible to emit double quoted strings containing double quotes.

This could cause nftables to choke on generated rulesets that contain
strings with embedded quotes, e.g. within firewall rule comments.

Since firewall3 (iptables based) historically allowed arbitrary characters
in comments and since we want to stay backwards compatible with existing
uci configurations we can not restrict the allowed input values either.

Work around the issue by substituting all double quotes with single quotes
when quoting strings for interpolation into the ruleset.

Fixes: https://github.com/openwrt/luci/issues/7091
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
root/usr/share/ucode/fw4.uc