Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
alpine
awall
Commits
e4b54f5d
Commit
e4b54f5d
authored
May 01, 2020
by
Kaarle Ritvanen
Browse files
switch to Lua 5.3
fixes
#8377
parent
02eda0dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
e4b54f5d
# Installer Makefile for Alpine Wall
# Copyright (C) 2012-20
18
Kaarle Ritvanen
# Copyright (C) 2012-20
20
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
...
...
awall/iptables.lua
View file @
e4b54f5d
...
...
@@ -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
)
...
...
awall/model.lua
View file @
e4b54f5d
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment