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
33853a10
Commit
33853a10
authored
Jun 18, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter: migrate functions here too
parent
d5bff281
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
30 deletions
+31
-30
filter.inc
src/etc/inc/filter.inc
+31
-0
pfsense-utils.inc
src/etc/inc/pfsense-utils.inc
+0
-30
No files found.
src/etc/inc/filter.inc
View file @
33853a10
...
@@ -99,6 +99,37 @@ function is_bogonsv6_used()
...
@@ -99,6 +99,37 @@ function is_bogonsv6_used()
return
$usebogonsv6
;
return
$usebogonsv6
;
}
}
/* sort by interface only, retain the original order of rules that apply to
the same interface */
function
filter_rules_sort
()
{
global
$config
;
/* mark each rule with the sequence number (to retain the order while sorting) */
for
(
$i
=
0
;
isset
(
$config
[
'filter'
][
'rule'
][
$i
]);
$i
++
)
{
$config
[
'filter'
][
'rule'
][
$i
][
'seq'
]
=
$i
;
}
usort
(
$config
[
'filter'
][
'rule'
],
"filter_rules_compare"
);
/* strip the sequence numbers again */
for
(
$i
=
0
;
isset
(
$config
[
'filter'
][
'rule'
][
$i
]);
$i
++
)
{
unset
(
$config
[
'filter'
][
'rule'
][
$i
][
'seq'
]);
}
}
function
filter_rules_compare
(
$a
,
$b
)
{
if
(
isset
(
$a
[
'floating'
])
&&
isset
(
$b
[
'floating'
]))
{
return
$a
[
'seq'
]
-
$b
[
'seq'
];
}
elseif
(
isset
(
$a
[
'floating'
]))
{
return
-
1
;
}
elseif
(
isset
(
$b
[
'floating'
]))
{
return
1
;
}
elseif
(
$a
[
'interface'
]
==
$b
[
'interface'
])
{
return
$a
[
'seq'
]
-
$b
[
'seq'
];
}
else
{
return
compare_interface_friendly_names
(
$a
[
'interface'
],
$b
[
'interface'
]);
}
}
function
filter_pflog_start
()
function
filter_pflog_start
()
{
{
if
(
isvalidpid
(
'/var/run/filterlog.pid'
))
{
if
(
isvalidpid
(
'/var/run/filterlog.pid'
))
{
...
...
src/etc/inc/pfsense-utils.inc
View file @
33853a10
...
@@ -577,36 +577,6 @@ function xml2array($contents, $get_attributes = 1, $priority = 'tag')
...
@@ -577,36 +577,6 @@ function xml2array($contents, $get_attributes = 1, $priority = 'tag')
return
(
$xml_array
);
return
(
$xml_array
);
}
}
/* sort by interface only, retain the original order of rules that apply to
the same interface */
function
filter_rules_sort
()
{
global
$config
;
/* mark each rule with the sequence number (to retain the order while sorting) */
for
(
$i
=
0
;
isset
(
$config
[
'filter'
][
'rule'
][
$i
]);
$i
++
)
{
$config
[
'filter'
][
'rule'
][
$i
][
'seq'
]
=
$i
;
}
usort
(
$config
[
'filter'
][
'rule'
],
"filter_rules_compare"
);
/* strip the sequence numbers again */
for
(
$i
=
0
;
isset
(
$config
[
'filter'
][
'rule'
][
$i
]);
$i
++
)
{
unset
(
$config
[
'filter'
][
'rule'
][
$i
][
'seq'
]);
}
}
function
filter_rules_compare
(
$a
,
$b
)
{
if
(
isset
(
$a
[
'floating'
])
&&
isset
(
$b
[
'floating'
]))
{
return
$a
[
'seq'
]
-
$b
[
'seq'
];
}
elseif
(
isset
(
$a
[
'floating'
]))
{
return
-
1
;
}
elseif
(
isset
(
$b
[
'floating'
]))
{
return
1
;
}
elseif
(
$a
[
'interface'
]
==
$b
[
'interface'
])
{
return
$a
[
'seq'
]
-
$b
[
'seq'
];
}
else
{
return
compare_interface_friendly_names
(
$a
[
'interface'
],
$b
[
'interface'
]);
}
}
/****f* legacy/load_mac_manufacturer_table
/****f* legacy/load_mac_manufacturer_table
* NAME
* NAME
* load_mac_manufacturer_table
* load_mac_manufacturer_table
...
...
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