summaryrefslogtreecommitdiff
path: root/libpod/networking_linux.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-09-27 14:21:50 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-09-28 13:40:27 +0200
commit1c8926285d1ecdfe201fe68896657573dcdc22b7 (patch)
treeeaedddbd8eae580bd5075fc7008355cf5d8ee930 /libpod/networking_linux.go
parentd0950f3efe2559049abbf45700309345c12a142f (diff)
downloadpodman-1c8926285d1ecdfe201fe68896657573dcdc22b7.tar.gz
podman-1c8926285d1ecdfe201fe68896657573dcdc22b7.tar.bz2
podman-1c8926285d1ecdfe201fe68896657573dcdc22b7.zip
move network alias validation to container create
Podman 4.0 currently errors when you use network aliases for a network which has dns disabled. Because the error happens on network setup this can cause regression for old working containers. The network backend should not validate this. Instead podman should check this at container create time and also for network connect. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'libpod/networking_linux.go')
-rw-r--r--libpod/networking_linux.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index e4fcfc271..e792a410c 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -1262,6 +1262,14 @@ func (c *Container) NetworkConnect(nameOrID, netName string, aliases []string) e
// get network status before we connect
networkStatus := c.getNetworkStatus()
+ network, err := c.runtime.network.NetworkInspect(netName)
+ if err != nil {
+ return err
+ }
+ if !network.DNSEnabled && len(aliases) > 0 {
+ return errors.Wrapf(define.ErrInvalidArg, "cannot set network aliases for network %q because dns is disabled", netName)
+ }
+
if err := c.runtime.state.NetworkConnect(c, netName, aliases); err != nil {
return err
}