Commit 8ec3bbd3 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

module namespace-related style adjustments

drop awall prefix when accessing submodules from the main module
remove module-level function/module shortcuts when used only once
parent 918e4f74
......@@ -35,12 +35,12 @@ function loadmodules(path)
end
Config = awall.object.class(awall.object.Object)
Config = object.class(object.Object)
function Config:init(confdirs, importdirs)
self.input = {}
self.iptables = awall.iptables.IPTables.new()
self.iptables = iptables.IPTables.new()
local required = {}
local imported = {}
......@@ -149,8 +149,8 @@ function Config:init(confdirs, importdirs)
for i, mod in ipairs(modules) do
for path, cls in pairs(mod.classmap) do
if self.input[path] then
awall.util.map(self.input[path],
function(obj) return cls.morph(obj, self) end)
util.map(self.input[path],
function(obj) return cls.morph(obj, self) end)
table.insert(locations, self.input[path])
end
end
......@@ -165,7 +165,7 @@ function Config:init(confdirs, importdirs)
end
end
self.ipset = awall.ipset.IPSet.new(self.input.ipset)
self.ipset = ipset.IPSet.new(self.input.ipset)
end
function Config:dump(iptdir, ipsfile)
......
......@@ -13,7 +13,6 @@ require 'awall.object'
require 'awall.util'
local class = awall.object.class
local contains = awall.util.contains
local families = {inet={cmd='iptables', file='rules-save'},
......@@ -67,7 +66,8 @@ function IPTables:dumpfile(family, iptfile)
for tbl, chains in pairs(self.config[family]) do
iptfile:write('*'..tbl..'\n')
for chain, rules in pairs(chains) do
iptfile:write(':'..chain..' '..(contains(builtin, chain) and
iptfile:write(':'..chain..' '..(awall.util.contains(builtin,
chain) and
'DROP' or '-')..' [0:0]\n')
end
for chain, rules in pairs(chains) do
......
......@@ -11,7 +11,6 @@ require 'awall.model'
require 'awall.util'
local model = awall.model
local util = awall.util
local NATRule = model.class(model.Rule)
......@@ -19,7 +18,7 @@ local NATRule = model.class(model.Rule)
function NATRule:init(context)
model.Rule.init(self, context)
for i, dir in ipairs({'in', 'out'}) do
if util.contains(self[dir], model.fwzone) then
if awall.util.contains(self[dir], model.fwzone) then
error('NAT rules not allowed for firewall zone')
end
end
......
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