From 4d3c934afd0ff4e6c86bba0ba5aad6b643e17931 Mon Sep 17 00:00:00 2001 From: Florian Lehner Date: Sat, 8 Jun 2024 14:15:59 +0200 Subject: [PATCH] unix: add icons handling Signed-off-by: Florian Lehner --- types.go | 1 + unix.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types.go b/types.go index c4ac546..6bbcc3a 100644 --- a/types.go +++ b/types.go @@ -159,6 +159,7 @@ type UnixAttribute struct { Shutdown *uint8 UID *uint32 Peer *uint32 + Icons []uint32 } // Based on inet_diag_sockopt diff --git a/unix.go b/unix.go index e886d20..abb29c9 100644 --- a/unix.go +++ b/unix.go @@ -39,9 +39,11 @@ func extractUnixAttributes(data []byte, info *UnixAttribute) error { case unixDiagIcons: tmp := ad.Bytes() numIcons := len(tmp) / 4 + icons := make([]uint32, 0, numIcons) for i := 0; i < numIcons; i++ { - fmt.Printf("icon: %d\t%d\n", i, binary.LittleEndian.Uint32(tmp[i*4:(i+1)*4])) + icons = append(icons, binary.LittleEndian.Uint32(tmp[i*4:(i+1)*4])) } + info.Icons = icons case unixDiagRQLen: rqlen := &UnixDiagRqLen{} err := unmarshalStruct(ad.Bytes(), rqlen)