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
caa5010a
Commit
caa5010a
authored
Jul 13, 2012
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
route tracking for incoming connections
parent
d5d5baee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
+41
-2
awall/modules/mark.lua
awall/modules/mark.lua
+40
-1
awall/util.lua
awall/util.lua
+1
-1
No files found.
awall/modules/mark.lua
View file @
caa5010a
...
...
@@ -8,6 +8,8 @@ Licensed under the terms of GPL2
module
(
...
,
package
.
seeall
)
require
'awall.model'
require
'awall.optfrag'
require
'awall.util'
local
model
=
awall
.
model
...
...
@@ -22,6 +24,43 @@ function MarkRule:target()
end
classes
=
{{
'mark'
,
MarkRule
}}
local
RouteTrackRule
=
model
.
class
(
MarkRule
)
function
RouteTrackRule
:
target
()
if
not
self
[
'mark-target'
]
then
self
[
'mark-target'
]
=
self
:
newchain
(
'mark'
)
end
return
self
[
'mark-target'
]
end
function
RouteTrackRule
:
servoptfrags
()
return
awall
.
optfrag
.
combinations
(
MarkRule
.
servoptfrags
(
self
),
{{
opts
=
'-m mark --mark 0'
}})
end
function
RouteTrackRule
:
extraoptfrags
()
return
{{
chain
=
self
:
target
(),
opts
=
'-j '
..
MarkRule
.
target
(
self
)},
{
chain
=
self
:
target
(),
opts
=
'-j CONNMARK --save-mark'
}}
end
classes
=
{{
'route-track'
,
RouteTrackRule
},
{
'mark'
,
MarkRule
}}
defrules
=
{}
function
defrules
.
pre
(
config
)
local
res
=
{}
if
awall
.
util
.
list
(
config
[
'route-track'
])[
1
]
then
for
i
,
family
in
ipairs
({
'inet'
,
'inet6'
})
do
for
i
,
chain
in
ipairs
({
'OUTPUT'
,
'PREROUTING'
})
do
table.insert
(
res
,
{
family
=
family
,
table
=
'mangle'
,
chain
=
chain
,
opts
=
'-m connmark ! --mark 0 -j CONNMARK --restore-mark'
})
end
end
end
return
res
end
awall/util.lua
View file @
caa5010a
...
...
@@ -7,7 +7,7 @@ Licensed under the terms of GPL2
module
(
...
,
package
.
seeall
)
local
function
list
(
var
)
function
list
(
var
)
if
not
var
then
return
{}
end
if
type
(
var
)
~=
'table'
then
return
{
var
}
end
if
not
next
(
var
)
then
return
{}
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