aboutsummaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-11-20 12:48:30 -0500
committerMatthew Heon <matthew.heon@pm.me>2019-11-26 09:56:14 -0500
commit01ae532a899997cb4c930003d4f2f5d5820ba7d7 (patch)
tree6abe3cfe142b406334d8867eaaa2f24670687301 /libpod/options.go
parentaef38585ed313d1096c1fa4f6281f36e5e47422b (diff)
downloadpodman-01ae532a899997cb4c930003d4f2f5d5820ba7d7.tar.gz
podman-01ae532a899997cb4c930003d4f2f5d5820ba7d7.tar.bz2
podman-01ae532a899997cb4c930003d4f2f5d5820ba7d7.zip
Allow --ip and --mac to be set when joining a CNI net
These only conflict when joining more than one network. We can still set a single CNI network and set a static IP and/or static MAC. Fixes #4500 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/libpod/options.go b/libpod/options.go
index bfbbb9e2d..f7f14eb26 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1041,8 +1041,8 @@ func WithStaticIP(ip net.IP) CtrCreateOption {
return errors.Wrapf(define.ErrInvalidArg, "cannot set a static IP if the container is not creating a network namespace")
}
- if len(ctr.config.Networks) != 0 {
- return errors.Wrapf(define.ErrInvalidArg, "cannot set a static IP if joining additional CNI networks")
+ if len(ctr.config.Networks) > 1 {
+ return errors.Wrapf(define.ErrInvalidArg, "cannot set a static IP if joining more than 1 CNI network")
}
ctr.config.StaticIP = ip
@@ -1066,8 +1066,8 @@ func WithStaticMAC(mac net.HardwareAddr) CtrCreateOption {
return errors.Wrapf(define.ErrInvalidArg, "cannot set a static MAC if the container is not creating a network namespace")
}
- if len(ctr.config.Networks) != 0 {
- return errors.Wrapf(define.ErrInvalidArg, "cannot set a static MAC if joining additional CNI networks")
+ if len(ctr.config.Networks) > 1 {
+ return errors.Wrapf(define.ErrInvalidArg, "cannot set a static MAC if joining more than 1 CNI network")
}
ctr.config.StaticMAC = mac