mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-15 17:15:18 +00:00
Fix nwfilter driver reload/shutdown handling when unprivileged
https://bugzilla.redhat.com/show_bug.cgi?id=903184 Although the nwfilter driver skips startup when running in a session libvirtd, it did not skip reload or shutdown. This caused errors to be reported when sending SIGHUP to libvirtd, and caused an abort() in libdbus on shutdown due to trying to remove a dbus filter that was never added (cherry picked from commit abbec81bd0c9bf917f2c63045222734d7e4411fb) Conflicts: src/nwfilter/nwfilter_driver.c - earlier changes f4ea67f and 79b8a56 related to using bool and auto-shutdown of drivers are not backported
This commit is contained in:
parent
5e10d0ef1e
commit
ba4e7b6344
@ -556,6 +556,7 @@ typedef struct _virNWFilterDriverState virNWFilterDriverState;
|
||||
typedef virNWFilterDriverState *virNWFilterDriverStatePtr;
|
||||
struct _virNWFilterDriverState {
|
||||
virMutex lock;
|
||||
bool privileged;
|
||||
|
||||
virNWFilterObjList nwfilters;
|
||||
|
||||
|
@ -183,6 +183,7 @@ nwfilterDriverStartup(int privileged)
|
||||
goto err_free_driverstate;
|
||||
|
||||
driverState->watchingFirewallD = (sysbus != NULL);
|
||||
driverState->privileged = privileged;
|
||||
|
||||
if (!privileged)
|
||||
return 0;
|
||||
@ -279,6 +280,9 @@ nwfilterDriverReload(void) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!driverState->privileged)
|
||||
return 0;
|
||||
|
||||
conn = virConnectOpen("qemu:///system");
|
||||
|
||||
if (conn) {
|
||||
@ -358,6 +362,7 @@ nwfilterDriverShutdown(void) {
|
||||
if (!driverState)
|
||||
return -1;
|
||||
|
||||
if (driverState->privileged) {
|
||||
virNWFilterConfLayerShutdown();
|
||||
virNWFilterTechDriversShutdown();
|
||||
virNWFilterDHCPSnoopShutdown();
|
||||
@ -373,6 +378,8 @@ nwfilterDriverShutdown(void) {
|
||||
|
||||
VIR_FREE(driverState->configDir);
|
||||
nwfilterDriverUnlock(driverState);
|
||||
}
|
||||
|
||||
virMutexDestroy(&driverState->lock);
|
||||
VIR_FREE(driverState);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user