From 40361b5a60ab0623915b47afd83c93ceb347e6d8 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 24 Mar 2023 15:06:04 +0100 Subject: [PATCH] pkg/netns: remove old pre go 1.10 workaround Because we do not not unlock the OS thread it will be killed by the runtime and not be reused for go 1.10+. Therefore there is no point in joining the original netns back which never worked as rootless. Go 1.10 is EOL for years and our code doesn't compile on such old versions anyway so it is safe to remove. Signed-off-by: Paul Holzinger --- pkg/netns/netns_linux.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pkg/netns/netns_linux.go b/pkg/netns/netns_linux.go index 1c01caabe..f2569d379 100644 --- a/pkg/netns/netns_linux.go +++ b/pkg/netns/netns_linux.go @@ -161,18 +161,6 @@ func NewNSWithName(name string) (ns.NetNS, error) { return } - // Put this thread back to the orig ns, since it might get reused (pre go1.10) - defer func() { - if err := origNS.Set(); err != nil { - if unshare.IsRootless() && strings.Contains(err.Error(), "operation not permitted") { - // When running in rootless mode it will fail to re-join - // the network namespace owned by root on the host. - return - } - logrus.Warnf("Unable to reset namespace: %q", err) - } - }() - // bind mount the netns from the current thread (from /proc) onto the // mount point. This causes the namespace to persist, even when there // are no threads in the ns. Make this a shared mount; it needs to be