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
4345a674
Commit
4345a674
authored
Nov 27, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter: convert filter_generate_user_rule et al
parent
bdd2b263
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
filter.inc
src/etc/inc/filter.inc
+16
-13
No files found.
src/etc/inc/filter.inc
View file @
4345a674
...
...
@@ -2131,11 +2131,14 @@ function filter_nat_rules_generate(&$FilterIflist)
return
$natrules
;
}
function
filter_generate_user_rule_arr
(
$rule
)
{
function
filter_generate_user_rule_arr
(
&
$FilterIflist
,
$rule
)
{
global
$config
;
update_filter_reload_status
(
sprintf
(
gettext
(
"Creating filter rule %s ..."
),
$rule
[
'descr'
]));
$ret
=
array
();
$line
=
filter_generate_user_rule
(
$rule
);
$line
=
filter_generate_user_rule
(
$
FilterIflist
,
$
rule
);
$ret
[
'rule'
]
=
$line
;
$ret
[
'interface'
]
=
$rule
[
'interface'
];
if
(
$rule
[
'descr'
]
!=
""
and
$line
!=
""
)
{
...
...
@@ -2143,6 +2146,7 @@ function filter_generate_user_rule_arr($rule) {
}
else
{
$ret
[
'descr'
]
=
"label
\"
USER_RULE
\"
"
;
}
return
$ret
;
}
...
...
@@ -2395,10 +2399,9 @@ function filter_generate_address(& $rule, $target = "source", $isnat = false) {
return
$src
;
}
function
filter_generate_user_rule
(
$rule
)
function
filter_generate_user_rule
(
&
$FilterIflist
,
$rule
)
{
global
$config
,
$g
,
$GatewaysList
;
$FilterIflist
=
filter_generate_optcfg_array
()
;
/* don't include disabled rules */
if
(
isset
(
$rule
[
'disabled'
]))
{
...
...
@@ -3261,28 +3264,28 @@ EOD;
if
(
!
empty
(
$rule
[
'ipprotocol'
])
&&
$rule
[
'ipprotocol'
]
==
"inet46"
)
{
if
(
isset
(
$rule
[
'floating'
]))
{
$rule
[
'ipprotocol'
]
=
"inet"
;
$rule_arr1
[]
=
filter_generate_user_rule_arr
(
$rule
);
$rule_arr1
[]
=
filter_generate_user_rule_arr
(
$
FilterIflist
,
$
rule
);
$rule
[
'ipprotocol'
]
=
"inet6"
;
$rule_arr1
[]
=
filter_generate_user_rule_arr
(
$rule
);
$rule_arr1
[]
=
filter_generate_user_rule_arr
(
$
FilterIflist
,
$
rule
);
}
else
if
(
is_interface_group
(
$rule
[
'interface'
])
||
in_array
(
$rule
[
'interface'
],
$vpn_and_ppp_ifs
))
{
$rule
[
'ipprotocol'
]
=
"inet"
;
$rule_arr2
[]
=
filter_generate_user_rule_arr
(
$rule
);
$rule_arr2
[]
=
filter_generate_user_rule_arr
(
$
FilterIflist
,
$
rule
);
$rule
[
'ipprotocol'
]
=
"inet6"
;
$rule_arr2
[]
=
filter_generate_user_rule_arr
(
$rule
);
$rule_arr2
[]
=
filter_generate_user_rule_arr
(
$
FilterIflist
,
$
rule
);
}
else
{
$rule
[
'ipprotocol'
]
=
"inet"
;
$rule_arr3
[]
=
filter_generate_user_rule_arr
(
$rule
);
$rule_arr3
[]
=
filter_generate_user_rule_arr
(
$
FilterIflist
,
$
rule
);
$rule
[
'ipprotocol'
]
=
"inet6"
;
$rule_arr3
[]
=
filter_generate_user_rule_arr
(
$rule
);
$rule_arr3
[]
=
filter_generate_user_rule_arr
(
$
FilterIflist
,
$
rule
);
}
$rule
[
'ipprotocol'
]
=
"inet46"
;
}
else
{
if
(
isset
(
$rule
[
'floating'
]))
{
$rule_arr1
[]
=
filter_generate_user_rule_arr
(
$rule
);
$rule_arr1
[]
=
filter_generate_user_rule_arr
(
$
FilterIflist
,
$
rule
);
}
elseif
(
is_interface_group
(
$rule
[
'interface'
])
||
in_array
(
$rule
[
'interface'
],
$vpn_and_ppp_ifs
))
{
$rule_arr2
[]
=
filter_generate_user_rule_arr
(
$rule
);
$rule_arr2
[]
=
filter_generate_user_rule_arr
(
$
FilterIflist
,
$
rule
);
}
else
{
$rule_arr3
[]
=
filter_generate_user_rule_arr
(
$rule
);
$rule_arr3
[]
=
filter_generate_user_rule_arr
(
$
FilterIflist
,
$
rule
);
}
}
if
(
isset
(
$rule
[
'sched'
])
&&
!
empty
(
$rule
[
'sched'
]))
{
...
...
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