comparison mod_firewall/mod_firewall.lua @ 967:a88f33fe6970

mod_firewall: Don't add empty conditions check when no conditions are listed in a rule
author Matthew Wild <mwild1@gmail.com>
date Sat, 06 Apr 2013 14:03:02 +0100
parents a65df6e97d94
children 53e158e44a44
comparison
equal deleted inserted replaced
966:a65df6e97d94 967:a88f33fe6970
254 -- chain (filter-based will be added later) 254 -- chain (filter-based will be added later)
255 for _, rule in ipairs(rules) do 255 for _, rule in ipairs(rules) do
256 for _, dep in ipairs(rule.deps) do 256 for _, dep in ipairs(rule.deps) do
257 include_dep(dep, code); 257 include_dep(dep, code);
258 end 258 end
259 local rule_code = "if ("..table.concat(rule.conditions, ") and (")..") then\n\t" 259 local rule_code = table.concat(rule.actions, "\n\t");
260 ..table.concat(rule.actions, "\n\t") 260 if #rule.conditions > 0 then
261 .."\n end\n"; 261 rule_code = "if ("..table.concat(rule.conditions, ") and (")..") then\n\t"
262 ..rule_code
263 .."\n end\n";
264 end
262 table.insert(code, rule_code); 265 table.insert(code, rule_code);
263 end 266 end
264 267
265 local code_string = [[return function (zones, fire_event, log) 268 local code_string = [[return function (zones, fire_event, log)
266 ]]..table.concat(code.global_header, "\n")..[[ 269 ]]..table.concat(code.global_header, "\n")..[[