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>
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>
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>
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>
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.
Fixescontainers/podman#12971
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>