comparison mod_firewall/mod_firewall.lua @ 6558:15a7749c7acb

mod_firewall: Remove unnecessary logging
author Matthew Wild <mwild1@gmail.com>
date Sun, 24 May 2026 20:07:30 +0100
parents 7477e97a9045
children
comparison
equal deleted inserted replaced
6557:2d916ba3253c 6558:15a7749c7acb
716 -- Loop through the chains in the script, and for each chain attach the compiled code to the 716 -- Loop through the chains in the script, and for each chain attach the compiled code to the
717 -- relevant events, keeping track in events_hooked so we can cleanly unload later 717 -- relevant events, keeping track in events_hooked so we can cleanly unload later
718 local events_hooked = {}; 718 local events_hooked = {};
719 for chain, chain_info in pairs(chain_functions) do 719 for chain, chain_info in pairs(chain_functions) do
720 local handler_code = chain_info.code; 720 local handler_code = chain_info.code;
721 module:log("warn", "Hooking %s for %s", chain, base_name);
722 local new_handler, err = compile_handler(handler_code, "mod_firewall:"..base_name.."::"..chain, chain_info.rules); 721 local new_handler, err = compile_handler(handler_code, "mod_firewall:"..base_name.."::"..chain, chain_info.rules);
723 if not new_handler then 722 if not new_handler then
724 module:log("error", "Compilation error for %s: %s", script, err); 723 module:log("error", "Compilation error for %s: %s", script, err);
725 errs = true; 724 errs = true;
726 break; 725 break;
727 else 726 else
728 local chain_definition = chains[chain]; 727 local chain_definition = chains[chain];
729 if chain_definition and chain_definition.type == "event" then 728 if chain_definition and chain_definition.type == "event" then
730 local handler = new_handler(chain_definition.pass_return); 729 local handler = new_handler(chain_definition.pass_return);
731 for _, event_name in ipairs(chain_definition) do 730 for _, event_name in ipairs(chain_definition) do
732 module:log("warn", "Hooking %s...", event_name);
733 events_hooked[event_name] = handler; 731 events_hooked[event_name] = handler;
734 module:hook(event_name, handler, chain_definition.priority); 732 module:hook(event_name, handler, chain_definition.priority);
735 end 733 end
736 elseif chain:sub(1, 5) ~= "user/" then 734 elseif chain:sub(1, 5) ~= "user/" then
737 module:log("warn", "Unknown chain %q", chain); 735 module:log("warn", "Unknown chain %q", chain);
738 else
739 module:log("warn", "Sad");
740 end 736 end
741 local event_name, handler = "firewall/chains/"..chain, new_handler(false); 737 local event_name, handler = "firewall/chains/"..chain, new_handler(false);
742 events_hooked[event_name] = handler; 738 events_hooked[event_name] = handler;
743 module:hook(event_name, handler); 739 module:hook(event_name, handler);
744 end 740 end