Skip to content
Snippets Groups Projects
Commit abc44bbb authored by Boyan Soubachov's avatar Boyan Soubachov Committed by Pankaj Garg
Browse files

Added linux sanity checking for /proc/net/dev (#93)

parent 0e781d97
Branches
Tags
No related merge requests found
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment