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
75c5ddf1
Commit
75c5ddf1
authored
Aug 09, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interfaces: small follow-up on get_interface_list()
parent
97d35c56
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
36 deletions
+36
-36
config.console.inc
src/etc/inc/config.console.inc
+1
-1
util.inc
src/etc/inc/util.inc
+35
-35
No files found.
src/etc/inc/config.console.inc
View file @
75c5ddf1
...
@@ -431,7 +431,7 @@ Then press ENTER to continue.
...
@@ -431,7 +431,7 @@ Then press ENTER to continue.
EOD;
EOD;
fgets
(
$fp
);
fgets
(
$fp
);
$iflist
=
get_interface_list
(
"media"
);
$iflist
=
get_interface_list
(
'media'
);
foreach
(
$iflist_prev
as
$ifn
=>
$ifa
)
{
foreach
(
$iflist_prev
as
$ifn
=>
$ifa
)
{
if
(
!
$ifa
[
'up'
]
&&
$iflist
[
$ifn
][
'up'
])
{
if
(
!
$ifa
[
'up'
]
&&
$iflist
[
$ifn
][
'up'
])
{
...
...
src/etc/inc/util.inc
View file @
75c5ddf1
...
@@ -813,49 +813,52 @@ function get_configured_ipv6_addresses()
...
@@ -813,49 +813,52 @@ function get_configured_ipv6_addresses()
/*
/*
* get_interface_list() - Return a list of all physical interfaces
* get_interface_list() - Return a list of all physical interfaces
* along with MAC and status.
* along with MAC
, IPv4
and status.
*
*
* $mode = "active" - use ifconfig -lu
* $mode = "active" - use ifconfig -lu
* "media" - use ifconfig to check physical connection
* "media" - use ifconfig to check physical connection
* status (much slower)
* status (much slower)
*/
*/
function
get_interface_list
(
$mode
=
"active"
,
$keyby
=
"physical"
,
$vfaces
=
""
)
{
function
get_interface_list
(
$mode
=
'active'
,
$keyby
=
'physical'
)
{
global
$config
;
global
$config
;
$upints
=
array
();
$upints
=
array
();
/* get a list of virtual interface types */
if
(
!
$vfaces
)
{
/* list of virtual interface types */
$vfaces
=
array
(
$vfaces
=
array
(
'bridge'
,
'_vlan'
,
'ppp'
,
'_wlan'
,
'pppoe'
,
'bridge'
,
'pptp'
,
'carp'
,
'l2tp'
,
'enc'
,
'sl'
,
'faith'
,
'gif'
,
'gif'
,
'gre'
,
'gre'
,
'faith'
,
'ipfw'
,
'lo'
,
'l2tp'
,
'ng'
,
'lagg'
,
'_vlan'
,
'lo'
,
'_wlan'
,
'ng'
,
'pflog'
,
'pflog'
,
'plip'
,
'plip'
,
'pfsync'
,
'ppp'
,
'enc'
,
'pppoe'
,
'tun'
,
'pptp'
,
'carp'
,
'pfsync'
,
'lagg'
,
'sl'
,
'vip'
,
'tun'
,
'ipfw'
'vip'
);
);
}
$ifnames
=
legacy_interface_listget
();
switch
(
$mode
)
{
switch
(
$mode
)
{
case
'active'
:
case
'active'
:
$upints
=
legacy_interface_listget
(
'up'
);
$upints
=
legacy_interface_listget
(
'up'
);
break
;
break
;
case
'media'
:
case
'media'
:
$intlist
=
legacy_interface_listget
()
;
$intlist
=
$ifnames
;
$ifconfig
=
""
;
$ifconfig
=
""
;
exec
(
"/sbin/ifconfig -a"
,
$ifconfig
);
exec
(
"/sbin/ifconfig -a"
,
$ifconfig
);
$regexp
=
'/('
.
implode
(
'|'
,
$intlist
)
.
'):\s/'
;
$regexp
=
'/('
.
implode
(
'|'
,
$intlist
)
.
'):\s/'
;
...
@@ -868,15 +871,12 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "")
...
@@ -868,15 +871,12 @@ function get_interface_list($mode = "active", $keyby = "physical", $vfaces = "")
}
}
break
;
break
;
default
:
default
:
$upints
=
legacy_interface_listget
()
;
$upints
=
$ifnames
;
break
;
break
;
}
}
$ifnames
=
legacy_interface_listget
();
foreach
(
$ifnames
as
$ifname
)
{
foreach
(
$ifnames
as
$ifname
)
{
if
(
in_array
(
array_shift
(
preg_split
(
'/\d/'
,
$ifname
)),
$vfaces
)
||
if
(
in_array
(
array_shift
(
preg_split
(
'/\d/'
,
$ifname
)),
$vfaces
))
{
stristr
(
$ifname
,
'_vlan'
)
||
stristr
(
$ifname
,
'_wlan'
))
{
continue
;
continue
;
}
}
...
...
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