Commit 2656abb8 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

eliminate deprecated varargs style

parent 0f5c611d
......@@ -103,7 +103,7 @@ fwzone = Zone.new()
IPSet = class(ConfigObject)
function IPSet:init(...)
ConfigObject.init(self, unpack(arg))
ConfigObject.init(self, ...)
if not self.type then self:error('Type not defined') end
......@@ -126,7 +126,7 @@ Rule = class(ConfigObject)
function Rule:init(...)
ConfigObject.init(self, unpack(arg))
ConfigObject.init(self, ...)
self.newchains = {}
......
......@@ -42,7 +42,7 @@ function RelatedRule:target() return 'ACCEPT' end
local Filter = model.class(model.Rule)
function Filter:init(...)
model.Rule.init(self, unpack(arg))
model.Rule.init(self, ...)
if not self.action then self.action = 'accept' end
......
--[[
Packet logging module for Alpine Wall
Copyright (C) 2012-2013 Kaarle Ritvanen
Copyright (C) 2012-2014 Kaarle Ritvanen
See LICENSE file for license details
]]--
......@@ -83,7 +83,7 @@ end
local LogRule = model.class(Rule)
function LogRule:init(...)
Rule.init(self, unpack(arg))
Rule.init(self, ...)
self.log = Log.get(self, self.log, true)
end
......
--[[
Packet marking module for Alpine Wall
Copyright (C) 2012-2013 Kaarle Ritvanen
Copyright (C) 2012-2014 Kaarle Ritvanen
See LICENSE file for license details
]]--
......@@ -17,7 +17,7 @@ local util = require('awall.util')
local MarkRule = class(model.Rule)
function MarkRule:init(...)
model.Rule.init(self, unpack(arg))
model.Rule.init(self, ...)
if not self.mark then self:error('Mark not specified') end
end
......
......@@ -17,7 +17,7 @@ local NATRule = model.class(model.Rule)
-- alpine v2.4 compatibility
function NATRule:init(...)
model.Rule.init(self, unpack(arg))
model.Rule.init(self, ...)
local attrs = {['ip-range']='to-addr', ['port-range']='to-port'}
for old, new in pairs(attrs) do
if not self[new] and self[old] then
......@@ -61,7 +61,7 @@ end
local DNATRule = model.class(NATRule)
function DNATRule:init(...)
NATRule.init(self, unpack(arg))
NATRule.init(self, ...)
self.params = {forbidif='out', subject='destination',
chains={'INPUT', 'PREROUTING'},
target='DNAT', deftarget='REDIRECT'}
......@@ -71,7 +71,7 @@ end
local SNATRule = model.class(NATRule)
function SNATRule:init(...)
NATRule.init(self, unpack(arg))
NATRule.init(self, ...)
self.params = {forbidif='in', subject='source',
chains={'OUTPUT', 'POSTROUTING'},
target='SNAT', deftarget='MASQUERADE'}
......
--[[
Transparent proxy module for Alpine Wall
Copyright (C) 2012-2013 Kaarle Ritvanen
Copyright (C) 2012-2014 Kaarle Ritvanen
See LICENSE file for license details
]]--
......@@ -21,7 +21,7 @@ local listpairs = util.listpairs
local TProxyRule = model.class(Rule)
function TProxyRule:init(...)
Rule.init(self, unpack(arg))
Rule.init(self, ...)
if not self['in'] then self:error('Ingress zone must be specified') end
if contains(list(self['in']), model.fwzone) then
......
--[[
Class model with inheritance and morphing support for Alpine Wall
Copyright (C) 2012 Kaarle Ritvanen
Copyright (C) 2012-2014 Kaarle Ritvanen
See LICENSE file for license details
]]--
......@@ -14,11 +14,11 @@ function class(base)
if not base and Object then base = Object end
if base then setmetatable(cls, {__index = base}) end
function cls.new(...) return cls.morph({}, unpack(arg)) end
function cls.new(...) return cls.morph({}, ...) end
function cls:morph(...)
setmetatable(self, mt)
self:init(unpack(arg))
self:init(...)
return self
end
......
--[[
Option fragment module for Alpine Wall
Copyright (C) 2012 Kaarle Ritvanen
Copyright (C) 2012-2014 Kaarle Ritvanen
See LICENSE file for license details
]]--
......@@ -8,9 +8,11 @@ See LICENSE file for license details
module(..., package.seeall)
function combinations(of1, ...)
local arg = {...}
if #arg == 0 then return of1 end
if not of1 then return combinations(unpack(arg)) end
if not of1 then return combinations(...) end
local of2 = arg[1]
table.remove(arg, 1)
......
--[[
User error handling for Alpine Wall
Copyright (C) 2012-2013 Kaarle Ritvanen
Copyright (C) 2012-2014 Kaarle Ritvanen
See LICENSE file for license details
]]--
......@@ -11,6 +11,7 @@ local prefix = 'awall user error: '
function raise(msg) error(prefix..msg) end
function call(f, ...)
local arg = {...}
return xpcall(
function() f(unpack(arg)) end,
function(msg)
......
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