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
d2e2fdf0
Commit
d2e2fdf0
authored
Jul 12, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for REDIRECT target
parent
946e90f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
awall/modules/nat.lua
awall/modules/nat.lua
+8
-9
No files found.
awall/modules/nat.lua
View file @
d2e2fdf0
...
...
@@ -46,8 +46,12 @@ function NATRule:chain() return self.params.chain end
function
NATRule
:
target
()
if
self
.
action
then
return
model
.
Rule
.
target
(
self
)
end
if
not
self
[
'ip-range'
]
then
self
:
error
(
'IP range not defined for NAT rule'
)
end
local
target
=
self
.
params
.
target
..
' --to-'
..
self
.
params
.
subject
..
' '
..
self
[
'ip-range'
]
local
target
if
self
[
'ip-range'
]
then
target
=
self
.
params
.
target
..
' --to-'
..
self
.
params
.
subject
..
' '
..
self
[
'ip-range'
]
else
target
=
self
.
params
.
deftarget
end
if
self
[
'port-range'
]
then
target
=
target
..
':'
..
self
[
'port-range'
]
end
return
target
end
...
...
@@ -58,7 +62,7 @@ local DNATRule = model.class(NATRule)
function
DNATRule
:
init
(
...
)
NATRule
.
init
(
self
,
unpack
(
arg
))
self
.
params
=
{
forbidif
=
'out'
,
subject
=
'destination'
,
chain
=
'PREROUTING'
,
target
=
'DNAT'
}
chain
=
'PREROUTING'
,
target
=
'DNAT'
,
deftarget
=
'REDIRECT'
}
end
...
...
@@ -67,12 +71,7 @@ local SNATRule = model.class(NATRule)
function
SNATRule
:
init
(
...
)
NATRule
.
init
(
self
,
unpack
(
arg
))
self
.
params
=
{
forbidif
=
'in'
,
subject
=
'source'
,
chain
=
'POSTROUTING'
,
target
=
'SNAT'
}
end
function
SNATRule
:
target
()
if
self
.
action
or
self
[
'ip-range'
]
then
return
NATRule
.
target
(
self
)
end
return
'MASQUERADE'
..
(
self
[
'port-range'
]
and
' --to-ports '
..
self
[
'port-range'
]
or
''
)
chain
=
'POSTROUTING'
,
target
=
'SNAT'
,
deftarget
=
'MASQUERADE'
}
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