summaryrefslogtreecommitdiff
path: root/pkg/specgen/container_validate.go
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-07-14 12:39:24 -0500
committerBrent Baude <bbaude@redhat.com>2020-07-15 07:06:58 -0500
commitc58127602e57ad489bd951760026dccd7593eeaf (patch)
treef6498628033dfaa81e173bd2eec1869e3b1773fe /pkg/specgen/container_validate.go
parent60127cf5e88ef53748cb601d7c27f082d284e7f4 (diff)
downloadpodman-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/container_validate.go')
-rw-r--r--pkg/specgen/container_validate.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/specgen/container_validate.go b/pkg/specgen/container_validate.go
index bf03ff0e7..622313a04 100644
--- a/pkg/specgen/container_validate.go
+++ b/pkg/specgen/container_validate.go
@@ -28,6 +28,15 @@ func exclusiveOptions(opt1, opt2 string) error {
// input for creating a container.
func (s *SpecGenerator) Validate() error {
+ if rootless.IsRootless() {
+ if s.StaticIP != nil || s.StaticIPv6 != nil {
+ return ErrNoStaticIPRootless
+ }
+ if s.StaticMAC != nil {
+ return ErrNoStaticMACRootless
+ }
+ }
+
//
// ContainerBasicConfig
//