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
3911de11
Commit
3911de11
authored
Jul 20, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
streamlined sanity checking for allowed input/output interface options
parent
f8da875b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
25 deletions
+12
-25
awall/model.lua
awall/model.lua
+12
-12
awall/modules/clampmss.lua
awall/modules/clampmss.lua
+0
-6
awall/modules/nat.lua
awall/modules/nat.lua
+0
-7
No files found.
awall/model.lua
View file @
3911de11
...
...
@@ -114,18 +114,13 @@ end
function
Rule
:
defaultzones
()
return
{
nil
,
fwzone
}
end
function
Rule
:
checkzoneoptfrag
(
ofrag
)
end
function
Rule
:
zoneoptfrags
()
local
function
zonepair
(
zin
,
zout
)
local
function
zofs
(
zone
,
dir
)
if
not
zone
then
return
zone
end
local
ofrags
=
zone
:
optfrags
(
dir
)
util
.
map
(
ofrags
,
function
(
x
)
self
:
checkzoneoptfrag
(
x
)
end
)
return
ofrags
return
zone
:
optfrags
(
dir
)
end
local
chain
,
ofrags
...
...
@@ -364,6 +359,17 @@ function Rule:trules()
util
.
extend
(
res
,
ffilter
(
self
:
extraoptfrags
()))
tag
(
res
,
'table'
,
self
:
table
(),
false
)
local
function
checkzof
(
ofrag
,
dir
,
chains
)
if
ofrag
[
dir
]
and
util
.
contains
(
chains
,
ofrag
.
chain
)
then
self
:
error
(
'Cannot specify '
..
dir
..
'bound interface ('
..
ofrag
[
dir
]
..
')'
)
end
end
for
i
,
ofrag
in
ipairs
(
res
)
do
checkzof
(
ofrag
,
'in'
,
{
'OUTPUT'
,
'POSTROUTING'
})
checkzof
(
ofrag
,
'out'
,
{
'INPUT'
,
'PREROUTING'
})
end
return
combinations
(
res
,
ffilter
({{
family
=
'inet'
},
{
family
=
'inet6'
}}))
end
...
...
@@ -400,12 +406,6 @@ end
function
ForwardOnlyRule
:
defaultzones
()
return
{
nil
}
end
function
ForwardOnlyRule
:
checkzoneoptfrag
(
ofrag
)
if
ofrag
.
out
then
self
:
error
(
'Cannot specify outbound interface ('
..
ofrag
.
out
..
')'
)
end
end
function
ForwardOnlyRule
:
chain
()
return
'PREROUTING'
end
...
...
awall/modules/clampmss.lua
View file @
3911de11
...
...
@@ -14,12 +14,6 @@ local model = awall.model
local
ClampMSSRule
=
model
.
class
(
model
.
ForwardOnlyRule
)
function
ClampMSSRule
:
checkzoneoptfrag
(
ofrag
)
if
ofrag
[
'in'
]
then
self
:
error
(
'Cannot specify inbound interface ('
..
ofrag
[
'in'
]
..
')'
)
end
end
function
ClampMSSRule
:
table
()
return
'mangle'
end
function
ClampMSSRule
:
chain
()
return
'POSTROUTING'
end
...
...
awall/modules/nat.lua
View file @
3911de11
...
...
@@ -14,13 +14,6 @@ local model = awall.model
local
NATRule
=
model
.
class
(
model
.
ForwardOnlyRule
)
function
NATRule
:
checkzoneoptfrag
(
ofrag
)
local
iface
=
ofrag
[
self
.
params
.
forbidif
]
if
iface
then
self
:
error
(
'Cannot specify '
..
self
.
params
.
forbidif
..
'bound interface ('
..
iface
..
')'
)
end
end
function
NATRule
:
trules
()
local
res
=
{}
for
i
,
ofrags
in
ipairs
(
model
.
ForwardOnlyRule
.
trules
(
self
))
do
...
...
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