diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-07-17 04:44:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-17 04:44:49 -0400 |
commit | d86bae2a01cb855d5964a2a3fbdd41afe68d62c8 (patch) | |
tree | b69b21c84a341626823eee106730134166e10b96 /pkg/specgen/namespaces.go | |
parent | 0bd51819428e402599f681f273947c805f4641cf (diff) | |
parent | d35d8125bf0be2add82003de1a4b89a0594bb9a0 (diff) | |
download | podman-d86bae2a01cb855d5964a2a3fbdd41afe68d62c8.tar.gz podman-d86bae2a01cb855d5964a2a3fbdd41afe68d62c8.tar.bz2 podman-d86bae2a01cb855d5964a2a3fbdd41afe68d62c8.zip |
Merge pull request #6965 from giuseppe/followup-pr6324
allow switching of port-forward approaches in rootless/using slirp4netns
Diffstat (limited to 'pkg/specgen/namespaces.go')
-rw-r--r-- | pkg/specgen/namespaces.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/specgen/namespaces.go b/pkg/specgen/namespaces.go index 5f56b242b..9bf2c5d05 100644 --- a/pkg/specgen/namespaces.go +++ b/pkg/specgen/namespaces.go @@ -108,7 +108,9 @@ func validateNetNS(n *Namespace) error { return nil } switch n.NSMode { - case "", Default, Host, Path, FromContainer, FromPod, Private, NoNetwork, Bridge, Slirp: + case Slirp: + break + case "", Default, Host, Path, FromContainer, FromPod, Private, NoNetwork, Bridge: break default: return errors.Errorf("invalid network %q", n.NSMode) @@ -119,8 +121,8 @@ func validateNetNS(n *Namespace) error { if len(n.Value) < 1 { return errors.Errorf("namespace mode %s requires a value", n.NSMode) } - } else { - // All others must NOT set a string value + } else if n.NSMode != Slirp { + // All others except must NOT set a string value if len(n.Value) > 0 { return errors.Errorf("namespace value %s cannot be provided with namespace mode %s", n.Value, n.NSMode) } @@ -250,7 +252,7 @@ func ParseNetworkNamespace(ns string) (Namespace, []string, error) { var cniNetworks []string // Net defaults to Slirp on rootless switch { - case ns == "slirp4netns": + case ns == "slirp4netns", strings.HasPrefix(ns, "slirp4netns:"): toReturn.NSMode = Slirp case ns == "pod": toReturn.NSMode = FromPod |