Commit f2298561 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

substitute table.concat for util.join

parent 0ae7ea31
......@@ -8,7 +8,6 @@ Licensed under the terms of GPL2
module(..., package.seeall)
require 'awall.object'
require 'awall.util'
IPSet = awall.object.class(awall.object.Object)
......@@ -23,7 +22,7 @@ end
function IPSet:dumpfile(name, ipsfile)
ipsfile:write('# ipset '..name..'\n')
ipsfile:write(awall.util.join(self:options(name), ' '))
ipsfile:write(table.concat(self:options(name), ' '))
ipsfile:write('\n')
end
......
......@@ -237,7 +237,7 @@ function Rule:servoptfrags()
if len == 1 then
opts = opts..' --dport '..plist[1]
elseif len > 1 then
opts = opts..' -m multiport --dports '..util.join(plist, ',')
opts = opts..' -m multiport --dports '..table.concat(plist, ',')
end
table.insert(res, {opts=opts})
......@@ -311,13 +311,13 @@ function Rule:trules()
end
local setopts = '-m set --match-set '..ipset.name..' '
setopts = setopts..util.join(util.map(util.list(ipset.args),
function(a)
if a == 'in' then return 'src' end
if a == 'out' then return 'dst' end
self:error('Invalid set direction argument')
end),
',')
setopts = setopts..table.concat(util.map(util.list(ipset.args),
function(a)
if a == 'in' then return 'src' end
if a == 'out' then return 'dst' end
self:error('Invalid set direction argument')
end),
',')
table.insert(ipsetofrags, {family=setdef.family, opts=setopts})
end
res = combinations(res, ipsetofrags)
......
......@@ -7,15 +7,6 @@ Licensed under the terms of GPL2
module(..., package.seeall)
function join(var, sep)
local res = ''
for i, s in listpairs(var) do
if i > 1 then res = res..sep end
res = res..s
end
return res
end
function list(var)
if not var then return {} end
if type(var) ~= 'table' then return {var} 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