]> xenbits.xensource.com Git - libvirt.git/commit
network: *un*set the firewalld zone while shutting down a network
authorLaine Stump <laine@redhat.com>
Wed, 4 Sep 2024 19:17:25 +0000 (15:17 -0400)
committerLaine Stump <laine@redhat.com>
Tue, 17 Sep 2024 15:22:56 +0000 (11:22 -0400)
commit200f60b2e12e68d618f6d59f0173bb507b678838
tree92119e456fa297f9698186da38cd22a5c97ad19d
parent1a3778fe0a5ad7bc00a0d60d6aa708fb89fabd2a
network: *un*set the firewalld zone while shutting down a network

When a bridge device for a virtual network had been placed in a
firewalld zone while starting the network, then even after the network
is shut down and the bridge device is deleted, its name will still
show up in the list of interfaces for whichever zone it had been in,
and this setting will persist through the next time a device with the
same name is created (until a zone is once again explicitly set, or
the device is removed via a firewalld API call).

Usually this isn't a problem, but in the case of forward mode='open',
someone might start the network once with a zone specified, then
shut down the network, remove the zone from its config, and start it
again; in this case the bridge device would come up using the zone
from the previous time it was started.

The solution to this is to remove the interface from whatever zone it
is in as the network is being shut down. There is no downside to doing
this, since the device is going to be deleted anyway. Note that
forward mode='bridge' uses a bridge device that was created outside of
libvirt, and libvirt won't be deleting that bridge, so we take care to
not unset the zone in that case.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/libvirt_private.syms
src/network/bridge_driver.c
src/network/bridge_driver_linux.c
src/network/bridge_driver_nop.c
src/network/bridge_driver_platform.h
src/util/virfirewalld.c
src/util/virfirewalld.h