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
6ff7a43e
Commit
6ff7a43e
authored
Apr 28, 2017
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log: allow spaces in prefix
parent
5a4cb73b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
awall/model.lua
awall/model.lua
+1
-2
awall/modules/log.lua
awall/modules/log.lua
+7
-3
awall/util.lua
awall/util.lua
+4
-1
No files found.
awall/model.lua
View file @
6ff7a43e
...
...
@@ -551,8 +551,7 @@ function M.Rule:trules()
if
not
self
.
string
.
match
then
self
:
error
(
'String match not defined'
)
end
setdefault
(
self
.
string
,
'algo'
,
'bm'
)
local
opts
=
'-m string --string "'
..
self
.
string
.
match
:
gsub
(
'
(
[
"
\\
]
)
', '
\\
%1'
)
..'"
'
local
opts
=
'-m string --string '
..
util
.
quote
(
self
.
string
.
match
)
for
_
,
attr
in
ipairs
{
'algo'
,
'from'
,
'to'
}
do
if
self
.
string
[
attr
]
then
...
...
awall/modules/log.lua
View file @
6ff7a43e
...
...
@@ -9,13 +9,13 @@ local model = require('awall.model')
local
class
=
model
.
class
local
combinations
=
require
(
'awall.optfrag'
).
combinations
local
setdefault
=
require
(
'awall.util'
)
.
setdefault
local
util
=
require
(
'awall.util'
)
local
LogLimit
=
class
(
model
.
Limit
)
function
LogLimit
:
init
(
...
)
setdefault
(
self
,
'src-mask'
,
false
)
util
.
setdefault
(
self
,
'src-mask'
,
false
)
LogLimit
.
super
(
self
):
init
(
...
)
end
...
...
@@ -74,7 +74,11 @@ function Log:target()
local
res
=
mode
:
upper
()
for
s
,
t
in
pairs
(
optmap
[
mode
])
do
if
self
[
s
]
then
res
=
res
..
' --'
..
mode
..
'-'
..
t
..
' '
..
self
[
s
]
end
local
value
=
self
[
s
]
if
value
then
if
s
==
'prefix'
then
value
=
util
.
quote
(
value
)
end
res
=
res
..
' --'
..
mode
..
'-'
..
t
..
' '
..
value
end
end
return
res
end
...
...
awall/util.lua
View file @
6ff7a43e
--[[
Utility module for Alpine Wall
Copyright (C) 2012-201
6
Kaarle Ritvanen
Copyright (C) 2012-201
7
Kaarle Ritvanen
See LICENSE file for license details
]]
--
...
...
@@ -116,6 +116,9 @@ function M.join(a, sep, b)
end
function
M
.
quote
(
s
)
return
'"'
..
s
:
gsub
(
'
(
[
"
\\
]
)
', '
\\
%1'
)
..'"
'
end
function
M.printtabulars
(
tables
)
local
colwidth
=
{}
for
i
,
tbl
in
ipairs
(
tables
)
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