Commit Graph

21 Commits

Author SHA1 Message Date
Paul Holzinger 13a70914f3 libnetwork/netavark: disable dns for macvlan
This is not supported in netavark so we should set to false by default
to make sure podman inspect will show the correct info.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-10-25 16:14:19 +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 9b0fcab189 libnetwork: add constants for network options
Duplicating strings is evil and can result in typos, lets expose the
options as constants.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-07 16:56:16 +02:00
cdoern 358905c1be libnetwork/netavark: add isolate option
depends on containers/netavark#275

Signed-off-by: cdoern <cdoern@redhat.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-07-07 16:40:30 +02:00
Doug Rabson 4ae0047591 Build libnetwork/netavark on FreeBSD
This only gets the libnetwork part to build - I have not tried to
get the rest of netavark to build on FreeBSD.

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-05-14 10:55:36 +01:00
Paul Holzinger cc110440e4 enable unparam, exportloopref and revive linters
unparam and exportloopref already work without changes.
For revive I had to silence many naming issues. I decided to silence them
instead of changing the name because I didn't want to break any code.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-05-06 13:32:35 +02:00
Kir Kolyshkin 82bf88ed0c libnetwork: rm nolint:golint hints
Those were added by commit 4fcb18dca, but are apparently no longer
needed.

Reported-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-04-11 15:03:50 -07:00
Paul Holzinger 82616479ae libnetwork: ipam driver none disable dns
When we create a network with the ipam driver none we should disabled
dns automatically. Since we mange no ips we cannot provide name
resolution anyway.

This fixes a problem I spotted when adding test to the podman CI.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-31 16:39:23 +02:00
Kir Kolyshkin a263ddda2d Fix typos found by codespell
Brought to you by

	make codespell

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2022-03-30 11:13:44 -07:00
Paul Holzinger cc5a65ab0f libnetwork/netavark: 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 ips will be assigned to this container.
This means that only the interfaces are created.

This will require a patch in netavark since it rejects the config when
no static ips are provided.

Ref containers/podman#13521

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-29 18:46:29 +02:00
OpenShift Merge Robot 490b31cd90 Merge pull request #968 from vrothberg/go1.18
go fmt: use go 1.18 conditional-build syntax
2022-03-18 12:00:40 +01:00
Valentin Rothberg 095aded91c go fmt: use go 1.18 conditional-build syntax
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-18 11:04:40 +01: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
Nalin Dahyabhai f9fd35395d libnetwork/netavark.netavarkNetwork.networkCreate(): close the file
If we have to write a new configuration file, close the file handle when
we finish writing to it, instead of just letting it pass out of scope.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2022-03-15 16:12:12 -04:00
Paul Holzinger a8296384fb netavark: macvlan allow internal networks
When internal is used the default route will not be added,
see https://github.com/containers/netavark/pull/246

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-25 14:41:51 +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 ff12fff79f netavark: add support for dns with internal
netavark + aardvark support this when we add a gateway ip to the config
so that aardvark can use this address to bind on it.
We only add the gateway when not internal or when dns is enabled. If
internal without dns we do not need the gw address.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-02-04 14:27:26 +01:00
Paul Holzinger 6dc28b6260 libnetwork fix subnet validation for macvlan
When we create a macvlan network we should not check if the subnet is
already in use on the host since this is expected for macvlan networks.
Only bridge networks should use this check.

Fixes containers/podman#12971

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-24 16:40:38 +01:00
Paul Holzinger f18244b9a1 libnetwork: netavark allow mtu option for macvlan
We have to support the mtu option for netavark since it is also
supported by CNI.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-10 16:55:19 +01:00
Paul Holzinger 4fcb18dca7 libnetwork: fix lint errors
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-17 14:24:21 +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