Commit e4b54f5d authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

switch to Lua 5.3

fixes #8377
parent 02eda0dd
# Installer Makefile for Alpine Wall
# Copyright (C) 2012-2018 Kaarle Ritvanen
# Copyright (C) 2012-2020 Kaarle Ritvanen
# See LICENSE file for license details
ROOT_DIR := /
LUA_VERSION := 5.2
LUA_VERSION := 5.3
resdir := usr/share/awall
confdir := etc/awall
......
......@@ -106,17 +106,19 @@ function BaseIPTables:flush() M.flush() end
M.IPTables = class(BaseIPTables)
function M.IPTables:init()
self.config = {}
setmetatable(
self.config,
{
__index=function(t, k)
t[k] = {}
setmetatable(t[k], getmetatable(t))
return t[k]
end
}
)
local function nestedtable(levels)
return levels > 0 and setmetatable(
{},
{
__index=function(t, k)
t[k] = nestedtable(getmetatable(t).levels - 1)
return t[k]
end,
levels=levels
}
) or {}
end
self.config = nestedtable(3)
end
function M.IPTables:dumpfile(family, iptfile)
......
......@@ -733,14 +733,14 @@ function M.Maskable:recentmask(name)
for i = 0, 3 do
if len <= i * 8 then octet = 0
elseif len > i * 8 + 7 then octet = 255
else octet = 256 - 2^(8 - len % 8) end
else octet = 256 - math.floor(2^(8 - len % 8)) end
mask = util.join(mask, '.', octet)
end
elseif family == 'inet6' then
while len > 0 do
if #mask % 5 == 4 then mask = mask..':' end
mask = mask..('%x'):format(16 - 2^math.max(0, 4 - len))
mask = mask..('%x'):format(16 - math.floor(2^math.max(0, 4 - len)))
len = len - 4
end
while #mask % 5 < 4 do mask = mask..'0' 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