diff options
author | Brent Baude <bbaude@redhat.com> | 2020-07-14 12:39:24 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2020-07-15 07:06:58 -0500 |
commit | c58127602e57ad489bd951760026dccd7593eeaf (patch) | |
tree | f6498628033dfaa81e173bd2eec1869e3b1773fe /pkg/specgen/pod_validate.go | |
parent | 60127cf5e88ef53748cb601d7c27f082d284e7f4 (diff) | |
download | podman-c58127602e57ad489bd951760026dccd7593eeaf.tar.gz podman-c58127602e57ad489bd951760026dccd7593eeaf.tar.bz2 podman-c58127602e57ad489bd951760026dccd7593eeaf.zip |
Error on rootless mac and ip addresses
When creating a pod or container where a static MAC or IP address is provided, we should return a proper error and exit as 125.
Fixes: #6972
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/specgen/pod_validate.go')
-rw-r--r-- | pkg/specgen/pod_validate.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/specgen/pod_validate.go b/pkg/specgen/pod_validate.go index 070bb1e41..69c3b58ed 100644 --- a/pkg/specgen/pod_validate.go +++ b/pkg/specgen/pod_validate.go @@ -1,6 +1,7 @@ package specgen import ( + "github.com/containers/libpod/v2/pkg/rootless" "github.com/containers/libpod/v2/pkg/util" "github.com/pkg/errors" ) @@ -18,6 +19,16 @@ func exclusivePodOptions(opt1, opt2 string) error { // Validate verifies the input is valid func (p *PodSpecGenerator) Validate() error { + + if rootless.IsRootless() { + if p.StaticIP != nil { + return ErrNoStaticIPRootless + } + if p.StaticMAC != nil { + return ErrNoStaticMACRootless + } + } + // PodBasicConfig if p.NoInfra { if len(p.InfraCommand) > 0 { |