Skip to content

Commit

Permalink
Merge pull request #17175 from Luap99/default-invalid-netname
Browse files Browse the repository at this point in the history
network create: do not allow `default` as name
  • Loading branch information
openshift-merge-robot authored Jan 20, 2023
2 parents 9c79e3b + 8669995 commit 4f4dce1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/domain/infra/abi/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, o

func (ic *ContainerEngine) NetworkCreate(ctx context.Context, network types.Network, createOptions *types.NetworkCreateOptions) (*types.Network, error) {
// TODO (5.0): Stop accepting "pasta" as value here
if util.StringInSlice(network.Name, []string{"none", "host", "bridge", "private", "slirp4netns", "container", "ns"}) {
if util.StringInSlice(network.Name, []string{"none", "host", "bridge", "private", "slirp4netns", "container", "ns", "default"}) {
return nil, fmt.Errorf("cannot create network with name %q because it conflicts with a valid network mode", network.Name)
}
network, err := ic.Libpod.Network().NetworkCreate(network, createOptions)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/network_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ var _ = Describe("Podman network create", func() {
})

It("podman network create with invalid name", func() {
for _, name := range []string{"none", "host", "bridge", "private", "slirp4netns", "container", "ns"} {
for _, name := range []string{"none", "host", "bridge", "private", "slirp4netns", "container", "ns", "default"} {
nc := podmanTest.Podman([]string{"network", "create", name})
nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(125))
Expand Down

0 comments on commit 4f4dce1

Please sign in to comment.