Commit Graph

12 Commits

Author SHA1 Message Date
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 774087c6a7 libnetwork: only validate static ip when ipam is host-local
If the dhcp ipam driver is used podman does not know any subnets so we
cannot verify if the given static ip is in the subnet.

Fixes containers/podman#12762

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-10 16:29:38 +01:00
Paul Holzinger 55acbe7f30 libnetwork: use atomic write for the backend file
It is possible that two processes write at the same time and this could
lead to an invalid value in the file.

I think this fixes a race condition which was observed in the buildah
integration tests.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-07 17:43:19 +01:00
Paul Holzinger c0ddc35864 libnetwork: add method to get the default network name
While we can store the default network name outside this network
interface it can become out of sync with the interface.

In buildah it can be useful to get the name from the interface.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-05 22:08:38 +01:00
Paul Holzinger 641e6dff04 libnetwork: netavark fix mac address marshal
The HardwareAddr type must bbe the actual value and not a pointer
otherwise the marshal logic will not use this function. Added a test to
confirm that this works.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-05 18:27:14 +01:00
Paul Holzinger 588325c4ae libnetwork: netavark use runrooot for ipam db
We should not use XDG_RUNTIME_DIR for the ipam db. This directory is
shared but we need the ipam db per storage. We can use the runroot for
this. It should be a tmpfs to reset the ipam assignments after a reboot.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-04 15:46:23 +01:00
Paul Holzinger 8893b57c6e libnetwork: remove unneeded Lockfile argument
If the caller can decide the lockfile path it is just more likely that
there is a lock missmatch due different lock names. We should always
just use the config dir and use a lock with a static name.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-04 15:46:23 +01:00
Paul Holzinger 25af87fbcc libnetwork: add function to get the default network backend
When the network backend is unset in the config we have to to figure out
if we need CNI or netavark. New installs should use netavark while
existing installs should continue to use CNI to prevent breaking
systems.

We use the following conditions to determine what backend to use:
1. read ${graphroot}/defaultNetworkBackend
2. find netavark binary (if not installed use CNI)
3. check containers, images and CNI networks and if there are some
   we have an existing install and should continue to use CNI

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-04 15:46:12 +01:00
ye.sijun f49c05b158 fix typo
Signed-off-by: ye.sijun <junnplus@gmail.com>
2022-01-03 20:15:46 +08:00
Daniel J Walsh c0aaea1296 Fix darwin builds
[NO NEW TEST NEEDED] Cross compile should be enough.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-23 04:32:56 -05: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