summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpod/networking_linux.go2
-rw-r--r--vendor/github.com/containers/common/pkg/netns/netns_linux.go (renamed from pkg/netns/netns_linux.go)14
-rw-r--r--vendor/modules.txt1
3 files changed, 9 insertions, 8 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 185f59306..e98e143a6 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -20,11 +20,11 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containers/common/libnetwork/types"
+ "github.com/containers/common/pkg/netns"
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/libpod/events"
"github.com/containers/podman/v3/pkg/errorhandling"
"github.com/containers/podman/v3/pkg/namespaces"
- "github.com/containers/podman/v3/pkg/netns"
"github.com/containers/podman/v3/pkg/resolvconf"
"github.com/containers/podman/v3/pkg/rootless"
"github.com/containers/podman/v3/pkg/util"
diff --git a/pkg/netns/netns_linux.go b/vendor/github.com/containers/common/pkg/netns/netns_linux.go
index 3e6e668b5..9f85e910d 100644
--- a/pkg/netns/netns_linux.go
+++ b/vendor/github.com/containers/common/pkg/netns/netns_linux.go
@@ -29,8 +29,8 @@ import (
"sync"
"github.com/containernetworking/plugins/pkg/ns"
- "github.com/containers/podman/v3/pkg/rootless"
- "github.com/containers/podman/v3/pkg/util"
+ "github.com/containers/common/pkg/util"
+ "github.com/containers/storage/pkg/unshare"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
@@ -38,7 +38,7 @@ import (
// GetNSRunDir returns the dir of where to create the netNS. When running
// rootless, it needs to be at a location writable by user.
func GetNSRunDir() (string, error) {
- if rootless.IsRootless() {
+ if unshare.IsRootless() {
rootlessDir, err := util.GetRuntimeDir()
if err != nil {
return "", err
@@ -56,7 +56,7 @@ func NewNS() (ns.NetNS, error) {
if err != nil {
return nil, fmt.Errorf("failed to generate random netns name: %v", err)
}
- nsName := fmt.Sprintf("cni-%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
+ nsName := fmt.Sprintf("netns-%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
return NewNSWithName(nsName)
}
@@ -152,7 +152,7 @@ func NewNSWithName(name string) (ns.NetNS, error) {
// 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 rootless.IsRootless() && strings.Contains(err.Error(), "operation not permitted") {
+ 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
@@ -180,13 +180,13 @@ func NewNSWithName(name string) (ns.NetNS, error) {
}
// UnmountNS unmounts the NS held by the netns object
-func UnmountNS(ns ns.NetNS) error {
+func UnmountNS(netns ns.NetNS) error {
nsRunDir, err := GetNSRunDir()
if err != nil {
return err
}
- nsPath := ns.Path()
+ nsPath := netns.Path()
// Only unmount if it's been bind-mounted (don't touch namespaces in /proc...)
if strings.HasPrefix(nsPath, nsRunDir) {
if err := unix.Unmount(nsPath, unix.MNT_DETACH); err != nil {
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 83b52afcb..bf73708d7 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -132,6 +132,7 @@ github.com/containers/common/pkg/download
github.com/containers/common/pkg/filters
github.com/containers/common/pkg/flag
github.com/containers/common/pkg/manifests
+github.com/containers/common/pkg/netns
github.com/containers/common/pkg/parse
github.com/containers/common/pkg/report
github.com/containers/common/pkg/report/camelcase