From 5c7935057c34cbdb27be3a584d35bff3fcd81202 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 16 Sep 2021 11:01:52 +0200 Subject: Do not allow network modes to be used as network names `podman network create` should not allow users to create networks with a name which is already used for a network mode in `podman run --network`. Fixes #11448 Signed-off-by: Paul Holzinger --- test/e2e/network_create_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go index d419a701d..ae9f112b5 100644 --- a/test/e2e/network_create_test.go +++ b/test/e2e/network_create_test.go @@ -343,4 +343,13 @@ var _ = Describe("Podman network create", func() { Expect(nc.OutputToString()).ToNot(ContainSubstring("dnsname")) }) + It("podman network create with invalid name", func() { + for _, name := range []string{"none", "host", "bridge", "private", "slirp4netns", "container", "ns"} { + nc := podmanTest.Podman([]string{"network", "create", name}) + nc.WaitWithDefaultTimeout() + Expect(nc).To(Exit(125)) + Expect(nc.ErrorToString()).To(ContainSubstring("cannot create network with name %q because it conflicts with a valid network mode", name)) + } + }) + }) -- cgit v1.2.3-54-g00ecf