# HG changeset patch # User Matthew Wild # Date 1488037561 0 # Node ID 24dbad147aef3674666685ca8559d93b2d05aef3 # Parent f20dd383093a86389fa1e1a33cd6bb40fe4b808b mod_firewall: Fix meta functions with to/from that weren't JID-based diff -r f20dd383093a -r 24dbad147aef mod_firewall/mod_firewall.lua --- a/mod_firewall/mod_firewall.lua Fri Feb 24 17:21:46 2017 +0000 +++ b/mod_firewall/mod_firewall.lua Sat Feb 25 15:46:01 2017 +0000 @@ -97,14 +97,13 @@ end if func_chain then for func_name in func_chain:gmatch("|(%w+)") do - if code == "to" or code == "from" then - if func_name == "bare" then - code = "bare_"..code; - table.insert(deps, code); - elseif func_name == "node" or func_name == "host" or func_name == "resource" then - table.insert(deps, "split_"..code); - code = code.."_"..func_name; - end + -- to/from are already available in local variables, use those if possible + if (code == "to" or code == "from") and func_name == "bare" then + code = "bare_"..code; + table.insert(deps, code); + elseif (code == "to" or code == "from") and (func_name == "node" or func_name == "host" or func_name == "resource") then + table.insert(deps, "split_"..code); + code = code.."_"..func_name; else assert(meta_funcs[func_name], "unknown function: "..func_name); local new_code, new_deps = meta_funcs[func_name](code);