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
Incidents
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
1ecedaa7
Commit
1ecedaa7
authored
Jul 20, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generalize creation of related rules based on cloning
parent
6504e9c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
awall/modules/filter.lua
awall/modules/filter.lua
+11
-6
No files found.
awall/modules/filter.lua
View file @
1ecedaa7
...
...
@@ -35,6 +35,16 @@ end
function
Filter
:
trules
()
local
res
=
{}
local
function
extrarules
(
cls
,
extra
)
local
params
=
{}
for
i
,
attr
in
ipairs
({
'in'
,
'out'
,
'src'
,
'dest'
,
'ipset'
,
'ipsec'
,
'service'
})
do
params
[
attr
]
=
self
[
attr
]
end
if
extra
then
for
k
,
v
in
pairs
(
extra
)
do
params
[
k
]
=
v
end
end
return
awall
.
util
.
extend
(
res
,
self
:
create
(
cls
,
params
):
trules
())
end
if
self
.
dnat
then
if
self
.
action
~=
'accept'
then
self
:
error
(
'dnat option not allowed with '
..
self
.
action
..
' action'
)
...
...
@@ -64,12 +74,7 @@ function Filter:trules()
self
:
error
(
self
.
dnat
..
' does not resolve to any IPv4 address'
)
end
local
dnat
=
{[
'ip-range'
]
=
dnataddr
}
for
i
,
attr
in
ipairs
({
'in'
,
'src'
,
'dest'
,
'service'
})
do
dnat
[
attr
]
=
self
[
attr
]
end
awall
.
util
.
extend
(
res
,
self
:
create
(
'dnat'
,
dnat
):
trules
())
extrarules
(
'dnat'
,
{[
'ip-range'
]
=
dnataddr
,
out
=
nil
})
end
awall
.
util
.
extend
(
res
,
model
.
Rule
.
trules
(
self
))
...
...
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