Commit Graph

9 Commits

Author SHA1 Message Date
Kir Kolyshkin 555b817630 libnetwork/types: rename RegexError to ErrInvalidName
... and add a deprecated alias so backward compatibility is still
preserved (and users can gradually switch to the new name).

Done because this is now also reported by staticcheck
(in addition to revive) linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-26 09:36:14 -07:00
Paul Holzinger b0fc9a6550 libnetwork/netavark: allow same bridge name with different vlan
When a vlan is used there should be no bridge name conflict check. It is
totally valid to have the same bridge with different vlans in two
configs and that is the intended use case.

Fixes #2095

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-01-30 19:28:24 +01:00
Paul Holzinger 7e485a635f Replace golang.org/x/exp/slices with slices from std
Use "slices" from the standard library, this package was added in go
1.21 so we can use it now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-04-22 14:12:47 +02:00
Oleksandr Redko 4dbd58b735 Refactor: replace raw loops with funcs from slices and maps
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-05 00:11:15 +02:00
Sascha Grunert 426d69c00f Switch to golang native error wrapping
`github.com/pkg/errors` is deprecated since quite some time so we now
use the native error wrapping for more idiomatic golang.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-12 10:54:07 +02:00
Paul Holzinger e2dabcc352 libnetwork/cni: allow network create with no ipam driver
Network create now uses the ipam driver. This allows the user to
configure the ipam driver manually instead of choosing a fixed default.
If the ipam driver is `none` no cni ipam plugin will be added to teh
config. This means that the interfaces are created but no extra ip
addresses are assigned.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-29 18:46:29 +02:00
Paul Holzinger 111b33c197 libnetwork: export "driver" as constant
It is better to use a global const than having to type "driver" at every
place.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-17 14:11:34 +01:00
Paul Holzinger 60766b5e5e libnetwork: create pick subnets from subnet pool
When we create a bridge network and no subnet is given we will a free
one automatically. The current logic just took the first free /24
network after 10.89.0.0. Now we will instead use the default subnet pool
from containers.conf. The default value is still the same but users can
change it if they want. This also fixes a problem where podman network
create could pick a public ipv4 network when all 10.0.0.0/8 networks
were already used. Now it will error if no free subnet is found in the
subnet pools.

Fixes #930

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-15 15:30:42 +01:00
Paul Holzinger 002673d22f add libnetwork package
Copy the libpod/network packages from podman to here so we can use the
same code in buildah as well.

This is mostly a one to one copy only the import paths have been changed
and some errors were added.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-16 19:07:38 +01:00