Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Ethr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Archive
Ethr
Commits
abc44bbb
Commit
abc44bbb
authored
5 years ago
by
Boyan Soubachov
Committed by
Pankaj Garg
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added linux sanity checking for /proc/net/dev (#93)
parent
0e781d97
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
internal/stats/linux.go
+8
-0
8 additions, 0 deletions
internal/stats/linux.go
with
8 additions
and
0 deletions
internal/stats/linux.go
+
8
−
0
View file @
abc44bbb
...
...
@@ -9,6 +9,7 @@ package stats
import
(
"bufio"
"fmt"
"net"
"os"
"strconv"
...
...
@@ -76,6 +77,13 @@ func buildNetDevStat(line string) (EthrNetDevStat, error) {
fields
:=
strings
.
Fields
(
line
)
interfaceName
:=
strings
.
TrimSuffix
(
fields
[
0
],
":"
)
if
len
(
fields
)
<
18
{
return
EthrNetDevStat
{},
errors
.
New
(
fmt
.
Sprintf
(
"buildNetDevStat: unexpected net stats file format, erroneous line %s"
),
line
)
}
rxInfo
,
err
:=
toNetDevInfo
(
fields
[
1
:
9
])
if
err
!=
nil
{
return
EthrNetDevStat
{},
errors
.
Wrap
(
err
,
"buildNetDevStat: error parsing rxInfo"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment