Fix parsing of interface aliases in netdev linux
Very old kernels expose interface aliases as `foo0:0`, adjust the line parsing to handle these names. Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
768be139be
commit
a528966dcd
4 changed files with 37 additions and 9 deletions
|
|
@ -43,11 +43,15 @@ func TestNetDevStats(t *testing.T) {
|
|||
t.Errorf("want netstat tun0 packets %s, got %s", want, got)
|
||||
}
|
||||
|
||||
if want, got := 6, len(netStats); want != got {
|
||||
if want, got := 7, len(netStats); want != got {
|
||||
t.Errorf("want count of devices to be %d, got %d", want, got)
|
||||
}
|
||||
|
||||
if _, ok := netStats["veth4B09XN"]["transmit_bytes"]; ok {
|
||||
t.Error("want fixture interface veth4B09XN to not exist, but it does")
|
||||
}
|
||||
|
||||
if want, got := "0", netStats["ibr10:30"]["receive_fifo"]; want != got {
|
||||
t.Error("want fixture interface ibr10:30 to exist, but it does not")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue