mirror of
https://github.com/vishvananda/netlink.git
synced 2025-09-27 04:05:59 +08:00
Implement UDP socket diagnostics
Signed-off-by: Sven Rebhan <srebhan@influxdata.com>
This commit is contained in:

committed by
Alessandro Boch

parent
8d48f50f55
commit
06219cde3e
@@ -1,3 +1,4 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package netlink
|
||||
@@ -75,3 +76,18 @@ func TestSocketDiagTCPInfo(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSocketDiagUDPnfo(t *testing.T) {
|
||||
for _, want := range []uint8{syscall.AF_INET, syscall.AF_INET6} {
|
||||
result, err := SocketDiagUDPInfo(want)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, r := range result {
|
||||
if got := r.InetDiagMsg.Family; got != want {
|
||||
t.Fatalf("protocol family = %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user