summaryrefslogtreecommitdiff
path: root/cmd/podman/common/netflags.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/common/netflags.go')
-rw-r--r--cmd/podman/common/netflags.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go
index a439eb792..2bb45476b 100644
--- a/cmd/podman/common/netflags.go
+++ b/cmd/podman/common/netflags.go
@@ -4,6 +4,7 @@ import (
"net"
"github.com/containers/libpod/cmd/podman/parse"
+ "github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/containers/libpod/pkg/specgen"
"github.com/pkg/errors"
@@ -149,6 +150,9 @@ func NetFlagsToNetOptions(cmd *cobra.Command) (*entities.NetOptions, error) {
if staticIP == nil {
return nil, errors.Errorf("%s is not an ip address", ip)
}
+ if staticIP.To4() == nil {
+ return nil, errors.Wrapf(define.ErrInvalidArg, "%s is not an IPv4 address", ip)
+ }
opts.StaticIP = &staticIP
}