Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
awall
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
awall
Commits
8cc299ff
Commit
8cc299ff
authored
Feb 16, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
descriptive chain names
parent
d45c0092
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
awall/model.lua
awall/model.lua
+12
-8
awall/modules/filter.lua
awall/modules/filter.lua
+1
-1
No files found.
awall/model.lua
View file @
8cc299ff
...
...
@@ -16,13 +16,6 @@ local util = awall.util
local
combinations
=
awall
.
optfrag
.
combinations
local
lastid
=
-
1
function
newchain
()
lastid
=
lastid
+
1
return
'awall-'
..
lastid
end
function
class
(
base
)
local
cls
=
{}
local
mt
=
{
__index
=
cls
}
...
...
@@ -88,6 +81,7 @@ Rule = class(Object)
function
Rule
:
init
()
local
config
=
awall
.
config
for
i
,
prop
in
ipairs
({
'in'
,
'out'
})
do
self
[
prop
]
=
self
[
prop
]
and
util
.
maplist
(
self
[
prop
],
function
(
z
)
...
...
@@ -96,7 +90,9 @@ function Rule:init()
error
(
'Invalid zone: '
..
z
)
end
)
or
self
:
defaultzones
()
end
if
self
.
service
then
if
type
(
self
.
service
)
==
'string'
then
self
.
label
=
self
.
service
end
self
.
service
=
util
.
maplist
(
self
.
service
,
function
(
s
)
return
config
.
service
[
s
]
or
error
(
'Invalid service: '
..
s
)
...
...
@@ -307,7 +303,7 @@ function Rule:trules()
local
target
if
addrchain
then
target
=
newchain
(
)
target
=
self
:
newchain
(
'address'
)
else
target
=
self
:
target
()
if
addrofrags
then
res
=
combinations
(
res
,
addrofrags
)
end
...
...
@@ -334,6 +330,14 @@ end
function
Rule
:
extraoptfrags
()
return
{}
end
local
lastid
=
{}
function
Rule
:
newchain
(
base
)
if
self
.
label
then
base
=
base
..
'-'
..
self
.
label
end
if
not
lastid
[
base
]
then
lastid
[
base
]
=
-
1
end
lastid
[
base
]
=
lastid
[
base
]
+
1
return
base
..
'-'
..
lastid
[
base
]
end
classmap
=
{
zone
=
Zone
}
...
...
awall/modules/filter.lua
View file @
8cc299ff
...
...
@@ -31,7 +31,7 @@ end
function
Filter
:
target
()
if
not
self
:
limit
()
then
return
model
.
Rule
.
target
(
self
)
end
if
not
self
[
'limit-target'
]
then
self
[
'limit-target'
]
=
model
.
newchain
(
)
end
if
not
self
[
'limit-target'
]
then
self
[
'limit-target'
]
=
self
:
newchain
(
'limit'
)
end
return
self
[
'limit-target'
]
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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