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.
Fixescontainers/podman#12762
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
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>
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>
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>
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>
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>
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>
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>