Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
alpine
awall
Commits
adc33e79
Commit
adc33e79
authored
Jan 08, 2017
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter: allow limits with pass action
parent
1d8ee361
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
awall/modules/filter.lua
awall/modules/filter.lua
+19
-5
No files found.
awall/modules/filter.lua
View file @
adc33e79
...
...
@@ -341,8 +341,12 @@ function Filter:mangleoptfrags(ofrags)
local
limit
=
self
:
limit
()
if
not
limit
then
return
Filter
.
super
(
self
):
mangleoptfrags
(
ofrags
)
end
if
self
.
action
~=
'accept'
then
self
:
error
(
'Cannot specify limit for '
..
self
.
action
..
' filter'
)
local
function
incompatible
(
item
)
self
:
error
(
'Limit incompatible with '
..
item
)
end
if
self
:
customtarget
()
or
self
:
logdefault
()
then
incompatible
(
'action: '
..
self
.
action
)
end
local
limitchain
=
self
:
uniqueid
(
'limit'
)
...
...
@@ -351,17 +355,27 @@ function Filter:mangleoptfrags(ofrags)
local
ofs
local
conn
=
limit
==
'conn-limit'
local
target
=
self
:
target
()
local
ct
=
conn
and
target
local
pl
=
not
target
and
self
.
log
local
uofs
,
sofs
=
limitobj
:
recentofrags
(
limitchain
)
if
uofs
then
ofs
=
self
:
combinelog
(
uofs
,
limitlog
,
'drop'
,
'DROP'
)
if
conn
then
extend
(
ofs
,
self
:
actofrags
(
self
.
log
))
end
extend
(
ofs
,
combinations
(
sofs
,
{{
target
=
conn
and
'ACCEPT'
}}))
local
nxt
if
ct
then
extend
(
ofs
,
self
:
actofrags
(
self
.
log
))
nxt
=
target
elseif
not
pl
then
nxt
=
false
end
extend
(
ofs
,
combinations
(
sofs
,
self
:
actofrags
(
pl
,
nxt
)))
else
if
pl
then
incompatible
(
'action or log'
)
end
local
limofs
=
limitobj
:
limitofrags
(
limitchain
)
ofs
=
c
onn
and
Filter
.
super
(
self
):
mangleoptfrags
(
limofs
)
or
ofs
=
c
t
and
Filter
.
super
(
self
):
mangleoptfrags
(
limofs
)
or
combinations
(
limofs
,
{{
target
=
'RETURN'
}})
extend
(
ofs
,
self
:
actofrags
(
limitlog
,
'DROP'
))
...
...
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