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
3cc070df
Commit
3cc070df
authored
Apr 29, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inc: replace another legacy PHP module function
parent
8842a552
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
10 deletions
+38
-10
interfaces.inc
src/etc/inc/interfaces.inc
+5
-3
interfaces.lib.inc
src/etc/inc/interfaces.lib.inc
+24
-0
util.inc
src/etc/inc/util.inc
+9
-7
No files found.
src/etc/inc/interfaces.inc
View file @
3cc070df
...
@@ -87,12 +87,14 @@ function interfaces_bring_up($interface) {
...
@@ -87,12 +87,14 @@ function interfaces_bring_up($interface) {
/*
/*
* Return the interface array
* Return the interface array
*/
*/
function
get_interface_arr
(
$flush
=
false
)
{
function
get_interface_arr
(
$flush
=
false
)
{
global
$interface_arr_cache
;
global
$interface_arr_cache
;
/* If the cache doesn't exist, build it */
/* If the cache doesn't exist, build it */
if
(
!
isset
(
$interface_arr_cache
)
or
$flush
)
if
(
!
isset
(
$interface_arr_cache
)
or
$flush
)
{
$interface_arr_cache
=
pfSense_interface_listget
();
$interface_arr_cache
=
legacy_interface_listget
();
}
return
$interface_arr_cache
;
return
$interface_arr_cache
;
}
}
...
...
src/etc/inc/interfaces.lib.inc
View file @
3cc070df
...
@@ -26,6 +26,30 @@
...
@@ -26,6 +26,30 @@
POSSIBILITY OF SUCH DAMAGE.
POSSIBILITY OF SUCH DAMAGE.
*/
*/
function
legacy_interface_listget
(
$flag
=
''
)
{
$cmd
=
'/sbin/ifconfig -l'
;
$ifs
=
null
;
if
(
$flag
===
'up'
)
{
$cmd
.=
'u'
;
}
else
if
(
$flag
===
'down'
)
{
$cmd
.=
'd'
;
}
exec
(
$cmd
.
' 2>&1'
,
$out
,
$ret
);
if
(
$ret
)
{
log_error
(
'The command `'
.
$cmd
.
'\' failed to execute'
);
return
(
$ifs
);
}
if
(
isset
(
$out
[
0
]))
{
$ifs
=
explode
(
' '
,
$out
[
0
]);
}
return
(
$ifs
);
}
function
legacy_interface_create
(
$ifs
)
function
legacy_interface_create
(
$ifs
)
{
{
$cmd
=
'/sbin/ifconfig '
.
escapeshellarg
(
$ifs
)
.
' create'
;
$cmd
=
'/sbin/ifconfig '
.
escapeshellarg
(
$ifs
)
.
' create'
;
...
...
src/etc/inc/util.inc
View file @
3cc070df
...
@@ -877,22 +877,24 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "")
...
@@ -877,22 +877,24 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "")
);
);
}
}
switch
(
$mode
)
{
switch
(
$mode
)
{
case
"active"
:
case
'active'
:
$upints
=
pfSense_interface_listget
(
IFF_UP
);
$upints
=
legacy_interface_listget
(
'up'
);
break
;
break
;
case
"media"
:
case
'media'
:
$intlist
=
pfSense
_interface_listget
();
$intlist
=
legacy
_interface_listget
();
$ifconfig
=
""
;
$ifconfig
=
""
;
exec
(
"/sbin/ifconfig -a"
,
$ifconfig
);
exec
(
"/sbin/ifconfig -a"
,
$ifconfig
);
$regexp
=
'/('
.
implode
(
'|'
,
$intlist
)
.
'):\s/'
;
$regexp
=
'/('
.
implode
(
'|'
,
$intlist
)
.
'):\s/'
;
$ifstatus
=
preg_grep
(
'/status:/'
,
$ifconfig
);
$ifstatus
=
preg_grep
(
'/status:/'
,
$ifconfig
);
foreach
(
$ifstatus
as
$status
)
{
foreach
(
$ifstatus
as
$status
)
{
$int
=
array_shift
(
$intlist
);
$int
=
array_shift
(
$intlist
);
if
(
stristr
(
$status
,
"active"
))
$upints
[]
=
$int
;
if
(
stristr
(
$status
,
'active'
))
{
$upints
[]
=
$int
;
}
}
}
break
;
break
;
default
:
default
:
$upints
=
pfSense
_interface_listget
();
$upints
=
legacy
_interface_listget
();
break
;
break
;
}
}
/* build interface list with netstat */
/* build interface list with netstat */
...
...
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