Use safe version of WithNetNS

This commit is contained in:
Martynas Pumputis committed 2016-10-19 16:15:59 +01:00
1 parent 947ae11fee
commit 3492cd93d0
4 files changed
+38 -57

No files matched your search

-10
View File
@@ -57,16 +57,6 @@ func WithNetNSLinkUnsafe(ns netns.NsHandle, ifName string, work func(link netlin
})
}
func WithNetNSLinkByPidUnsafe(pid int, ifName string, work func(link netlink.Link) error) error {
ns, err := netns.GetFromPid(pid)
if err != nil {
return err
}
defer ns.Close()
return WithNetNSLinkUnsafe(ns, ifName, work)
}
// A safe version of WithNetNS* which creates a process executing
// "nsenter --net=<ns-path> weaveutil <cmd> [args]".
func WithNetNS(nsPath string, cmd string, args ...string) (string, error) {