Commit c9aec673 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

make module attributes optional

parent 2fbe1770
...@@ -26,12 +26,12 @@ function loadmodules(path) ...@@ -26,12 +26,12 @@ function loadmodules(path)
defrules = {} defrules = {}
local function readmetadata(mod) local function readmetadata(mod)
for i, clsdef in ipairs(mod.classes) do for i, clsdef in ipairs(mod.classes or {}) do
local path, cls = unpack(clsdef) local path, cls = unpack(clsdef)
classmap[path] = cls classmap[path] = cls
table.insert(procorder, path) table.insert(procorder, path)
end end
for phase, rules in pairs(mod.defrules) do for phase, rules in pairs(mod.defrules or {}) do
if not defrules[phase] then defrules[phase] = {} end if not defrules[phase] then defrules[phase] = {} end
table.insert(defrules[phase], rules) table.insert(defrules[phase], rules)
end end
......
...@@ -422,4 +422,4 @@ function ForwardOnlyRule:chain() return 'PREROUTING' end ...@@ -422,4 +422,4 @@ function ForwardOnlyRule:chain() return 'PREROUTING' end
classes = {{'zone', Zone}} classes = {{'zone', Zone}}
defrules = {}
...@@ -28,5 +28,3 @@ end ...@@ -28,5 +28,3 @@ end
classes = {{'clamp-mss', ClampMSSRule}} classes = {{'clamp-mss', ClampMSSRule}}
defrules = {}
...@@ -7,8 +7,6 @@ Licensed under the terms of GPL2 ...@@ -7,8 +7,6 @@ Licensed under the terms of GPL2
module(..., package.seeall) module(..., package.seeall)
classes = {}
-- TODO configuration of the ipset via JSON config -- TODO configuration of the ipset via JSON config
defrules = {['post-snat']={{family='inet', table='nat', defrules = {['post-snat']={{family='inet', table='nat',
chain='POSTROUTING', chain='POSTROUTING',
......
...@@ -59,5 +59,3 @@ end ...@@ -59,5 +59,3 @@ end
classes = {{'dnat', DNATRule}, classes = {{'dnat', DNATRule},
{'snat', SNATRule}} {'snat', SNATRule}}
defrules = {}
...@@ -23,5 +23,3 @@ end ...@@ -23,5 +23,3 @@ end
classes = {{'no-track', NoTrackRule}} classes = {{'no-track', NoTrackRule}}
defrules = {}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment