fw4: avoid emitting invalid rule jump targets
authorJo-Philipp Wich <jo@mein.io>
Fri, 4 Aug 2023 22:46:47 +0000 (00:46 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 4 Aug 2023 22:46:47 +0000 (00:46 +0200)
Avoid emitting a bogus chain jump for actionless rules bound to a
log-enabled source zone.

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

index 06ef932c8a501bbc057669629d3b8ebeabde4aa7..cba7b024440749584f79a2affaadf6dedb2c2f91 100644 (file)
@@ -2380,7 +2380,7 @@ return {
                        }
                }
 
-               let need_src_action_chain = (rule) => (rule.src?.zone?.log && rule.target != "accept");
+               let need_src_action_chain = (rule) => (rule.src?.zone?.log && rule.target && rule.target != "accept");
 
                let add_rule = (family, proto, saddrs, daddrs, sports, dports, icmptypes, icmpcodes, ipset, rule) => {
                        let r = {