From f87d9813da23e81b47bb990e67a010be32324d9a Mon Sep 17 00:00:00 2001 From: Joe Stringer Date: Fri, 9 Nov 2018 14:54:37 -0800 Subject: [PATCH] [net][linux] Support socket tables in nested namespaces Signed-off-by: Joe Stringer --- net/net_linux.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/net_linux.go b/net/net_linux.go index 616c10a..71842fb 100644 --- a/net/net_linux.go +++ b/net/net_linux.go @@ -393,7 +393,11 @@ func statsFromInodes(root string, pid int32, tmap []netConnectionKindType, inode var path string var connKey string var ls []connTmp - path = fmt.Sprintf("%s/net/%s", root, t.filename) + if pid == 0 { + path = fmt.Sprintf("%s/net/%s", root, t.filename) + } else { + path = fmt.Sprintf("%s/%d/net/%s", root, pid, t.filename) + } switch t.family { case syscall.AF_INET, syscall.AF_INET6: ls, err = processInet(path, t, inodes, pid)