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/specgen.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/specgen.go')
-rw-r--r-- | pkg/specgen/specgen.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index 16d4b7c8c..17583d82a 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -1,6 +1,7 @@ package specgen import ( + "errors" "net" "syscall" @@ -469,6 +470,15 @@ type PortMapping struct { Protocol string `json:"protocol,omitempty"` } +var ( + // ErrNoStaticIPRootless is used when a rootless user requests to assign a static IP address + // to a pod or container + ErrNoStaticIPRootless error = errors.New("rootless containers and pods cannot be assigned static IP addresses") + // ErrNoStaticMACRootless is used when a rootless user requests to assign a static MAC address + // to a pod or container + ErrNoStaticMACRootless error = errors.New("rootless containers and pods cannot be assigned static MAC addresses") +) + // NewSpecGenerator returns a SpecGenerator struct given one of two mandatory inputs func NewSpecGenerator(arg string, rootfs bool) *SpecGenerator { csc := ContainerStorageConfig{} |