Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
5d286431
Commit
5d286431
authored
May 31, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(filter.inc) restructure filter advanced options
parent
d32f08b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
44 deletions
+28
-44
filter.inc
src/etc/inc/filter.inc
+28
-44
No files found.
src/etc/inc/filter.inc
View file @
5d286431
...
...
@@ -2204,50 +2204,34 @@ function filter_generate_user_rule(&$FilterIflist, $rule)
}
if
(
$noadvoptions
==
false
)
{
if
((
isset
(
$rule
[
'max'
])
&&
$rule
[
'max'
]
<>
""
)
||
(
isset
(
$rule
[
'max-src-nodes'
])
&&
$rule
[
'max-src-nodes'
]
<>
""
)
||
(
isset
(
$rule
[
'max-src-states'
])
&&
$rule
[
'max-src-states'
]
<>
""
)
||
((
isset
(
$rule
[
'protocol'
])
&&
in_array
(
$rule
[
'protocol'
],
array
(
"tcp"
,
"tcp/udp"
)))
&&
((
isset
(
$rule
[
'statetimeout'
])
&&
$rule
[
'statetimeout'
]
<>
""
)
||
(
isset
(
$rule
[
'max-src-conn'
])
&&
$rule
[
'max-src-conn'
]
<>
""
)
||
(
isset
(
$rule
[
'max-src-conn-rate'
])
&&
$rule
[
'max-src-conn-rate'
]
<>
""
)
||
(
isset
(
$rule
[
'max-src-conn-rates'
])
&&
$rule
[
'max-src-conn-rates'
]
<>
""
)))
||
isset
(
$rule
[
'sloppy'
])
||
isset
(
$rule
[
'nopfsync'
]))
{
$aline
[
'flags'
]
.=
"( "
;
$advanced_options
=
array
();
if
(
isset
(
$rule
[
'sloppy'
]))
{
$aline
[
'flags'
]
.
=
"sloppy "
;
$advanced_options
[]
=
"sloppy "
;
}
if
(
isset
(
$rule
[
'nopfsync'
]))
{
$aline
[
'flags'
]
.
=
"no-sync "
;
$advanced_options
[]
=
"no-sync "
;
}
if
(
isset
(
$rule
[
'max'
])
&&
$rule
[
'max'
]
<>
""
)
{
$aline
[
'flags'
]
.
=
"max "
.
$rule
[
'max'
]
.
" "
;
$advanced_options
[]
=
"max "
.
$rule
[
'max'
]
.
" "
;
}
if
(
isset
(
$rule
[
'max-src-nodes'
])
&&
$rule
[
'max-src-nodes'
]
<>
""
)
{
$aline
[
'flags'
]
.
=
"max-src-nodes "
.
$rule
[
'max-src-nodes'
]
.
" "
;
$advanced_options
[]
=
"max-src-nodes "
.
$rule
[
'max-src-nodes'
]
.
" "
;
}
if
((
in_array
(
$rule
[
'protocol'
],
array
(
"tcp"
,
"tcp/udp"
)))
&&
isset
(
$rule
[
'max-src-conn'
])
&&
$rule
[
'max-src-conn'
]
<>
""
)
{
$aline
[
'flags'
]
.=
"max-src-conn "
.
$rule
[
'max-src-conn'
]
.
" "
;
if
((
in_array
(
$rule
[
'protocol'
],
array
(
"tcp"
,
"tcp/udp"
)))
&&
!
empty
(
$rule
[
'max-src-conn'
]))
{
$advanced_options
[]
=
"max-src-conn "
.
$rule
[
'max-src-conn'
]
.
" "
;
}
if
(
isset
(
$rule
[
'max-src-states'
])
&&
$rule
[
'max-src-states'
]
<>
""
)
{
$aline
[
'flags'
]
.=
"max-src-states "
.
$rule
[
'max-src-states'
]
.
" "
;
}
if
((
in_array
(
$rule
[
'protocol'
],
array
(
"tcp"
,
"tcp/udp"
)))
&&
isset
(
$rule
[
'statetimeout'
])
&&
$rule
[
'statetimeout'
]
<>
""
)
{
$aline
[
'flags'
]
.=
"tcp.established "
.
$rule
[
'statetimeout'
]
.
" "
;
}
if
((
in_array
(
$rule
[
'protocol'
],
array
(
"tcp"
,
"tcp/udp"
)))
&&
isset
(
$rule
[
'max-src-conn-rate'
])
&&
$rule
[
'max-src-conn-rate'
]
<>
""
&&
isset
(
$rule
[
'max-src-conn-rates'
])
&&
$rule
[
'max-src-conn-rates'
]
<>
""
)
{
$aline
[
'flags'
]
.=
"max-src-conn-rate "
.
$rule
[
'max-src-conn-rate'
]
.
" "
;
$aline
[
'flags'
]
.=
"/"
.
$rule
[
'max-src-conn-rates'
]
.
", overload <virusprot> flush global "
;
}
$aline
[
'flags'
]
.=
" ) "
;
$advanced_options
[]
=
"max-src-states "
.
$rule
[
'max-src-states'
]
.
" "
;
}
if
((
in_array
(
$rule
[
'protocol'
],
array
(
"tcp"
,
"tcp/udp"
)))
&&
!
empty
(
$rule
[
'statetimeout'
]))
{
$advanced_options
[]
=
"tcp.established "
.
$rule
[
'statetimeout'
]
.
" "
;
}
if
((
in_array
(
$rule
[
'protocol'
],
array
(
"tcp"
,
"tcp/udp"
)))
&&
!
empty
(
$rule
[
'max-src-conn-rate'
])
&&
!
empty
(
$rule
[
'max-src-conn-rates'
]))
{
$advanced_options
[]
=
"max-src-conn-rate "
.
$rule
[
'max-src-conn-rate'
]
.
" "
.
"/"
.
$rule
[
'max-src-conn-rates'
]
.
", overload <virusprot> flush global "
;
}
if
(
count
(
$advanced_options
)
>
0
)
{
$aline
[
'flags'
]
.=
"( "
.
implode
(
" "
,
$advanced_options
)
.
" ) "
;
}
}
}
...
...
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