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
9374b8ad
Commit
9374b8ad
authored
Jul 17, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interfaces: fix edge case parsing of flags, mtu and laggport
parent
37f92da4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
interfaces.lib.inc
src/etc/inc/interfaces.lib.inc
+6
-3
No files found.
src/etc/inc/interfaces.lib.inc
View file @
9374b8ad
...
...
@@ -160,7 +160,7 @@ function legacy_vlan_tag($ifs, $member, $tag, $pcp)
}
}
function
legacy_interface_stats
(
$ifs
=
null
)
function
legacy_interface_stats
(
$ifs
=
null
)
{
if
(
$ifs
!=
null
)
{
// only request data for selected interface
...
...
@@ -218,7 +218,7 @@ function legacy_interfaces_details($intf = null)
$current_interface
=
null
;
foreach
(
$ifconfig_data
as
$line
)
{
$line_parts
=
explode
(
' '
,
$line
);
if
(
strpos
(
trim
(
$line
),
'flags='
)
!==
false
)
{
if
(
strpos
(
trim
(
$line
),
'flags='
)
!==
false
&&
$line
[
0
]
!=
"
\t
"
)
{
$current_interface
=
explode
(
':'
,
$line
)[
0
];
$result
[
$current_interface
]
=
array
();
$result
[
$current_interface
][
"capabilities"
]
=
array
();
...
...
@@ -226,6 +226,9 @@ function legacy_interfaces_details($intf = null)
$result
[
$current_interface
][
"macaddr"
]
=
"00:00:00:00:00:00"
;
$result
[
$current_interface
][
"ipv4"
]
=
array
();
$result
[
$current_interface
][
"ipv6"
]
=
array
();
if
(
preg_match
(
"/ mtu ([0-9]*).*$/"
,
$line
,
$matches
))
{
$result
[
$current_interface
][
"mtu"
]
=
$matches
[
1
];
}
}
elseif
(
empty
(
$current_interface
))
{
// skip parsing, no interface found (yet)
continue
;
...
...
@@ -291,7 +294,7 @@ function legacy_interfaces_details($intf = null)
if
(
empty
(
$result
[
$current_interface
][
'laggport'
]))
{
$result
[
$current_interface
][
'laggport'
]
=
array
();
}
$result
[
$current_interface
][
'laggport'
][]
=
$matches
[
1
];
$result
[
$current_interface
][
'laggport'
][]
=
explode
(
' '
,
trim
(
$matches
[
1
]))[
0
];
}
}
...
...
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