mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
Fix nwfilter driver reload/shutdown handling when unprivileged
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
This commit is contained in:
parent
682c79c4f5
commit
abbec81bd0
@ -556,6 +556,7 @@ typedef struct _virNWFilterDriverState virNWFilterDriverState;
|
|||||||
typedef virNWFilterDriverState *virNWFilterDriverStatePtr;
|
typedef virNWFilterDriverState *virNWFilterDriverStatePtr;
|
||||||
struct _virNWFilterDriverState {
|
struct _virNWFilterDriverState {
|
||||||
virMutex lock;
|
virMutex lock;
|
||||||
|
bool privileged;
|
||||||
|
|
||||||
virNWFilterObjList nwfilters;
|
virNWFilterObjList nwfilters;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ nwfilterDriverInstallDBusMatches(DBusConnection *sysbus ATTRIBUTE_UNUSED)
|
|||||||
* Initialization function for the QEmu daemon
|
* Initialization function for the QEmu daemon
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
nwfilterDriverStartup(bool privileged ATTRIBUTE_UNUSED,
|
nwfilterDriverStartup(bool privileged,
|
||||||
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
|
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
|
||||||
void *opaque ATTRIBUTE_UNUSED)
|
void *opaque ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
@ -185,6 +185,7 @@ nwfilterDriverStartup(bool privileged ATTRIBUTE_UNUSED,
|
|||||||
goto err_free_driverstate;
|
goto err_free_driverstate;
|
||||||
|
|
||||||
driverState->watchingFirewallD = (sysbus != NULL);
|
driverState->watchingFirewallD = (sysbus != NULL);
|
||||||
|
driverState->privileged = privileged;
|
||||||
|
|
||||||
if (!privileged)
|
if (!privileged)
|
||||||
return 0;
|
return 0;
|
||||||
@ -275,6 +276,9 @@ nwfilterDriverReload(void) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!driverState->privileged)
|
||||||
|
return 0;
|
||||||
|
|
||||||
conn = virConnectOpen("qemu:///system");
|
conn = virConnectOpen("qemu:///system");
|
||||||
|
|
||||||
if (conn) {
|
if (conn) {
|
||||||
@ -333,21 +337,24 @@ nwfilterDriverShutdown(void) {
|
|||||||
if (!driverState)
|
if (!driverState)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virNWFilterConfLayerShutdown();
|
if (driverState->privileged) {
|
||||||
virNWFilterTechDriversShutdown();
|
virNWFilterConfLayerShutdown();
|
||||||
virNWFilterDHCPSnoopShutdown();
|
virNWFilterTechDriversShutdown();
|
||||||
virNWFilterLearnShutdown();
|
virNWFilterDHCPSnoopShutdown();
|
||||||
virNWFilterIPAddrMapShutdown();
|
virNWFilterLearnShutdown();
|
||||||
|
virNWFilterIPAddrMapShutdown();
|
||||||
|
|
||||||
nwfilterDriverLock(driverState);
|
nwfilterDriverLock(driverState);
|
||||||
|
|
||||||
nwfilterDriverRemoveDBusMatches();
|
nwfilterDriverRemoveDBusMatches();
|
||||||
|
|
||||||
/* free inactive nwfilters */
|
/* free inactive nwfilters */
|
||||||
virNWFilterObjListFree(&driverState->nwfilters);
|
virNWFilterObjListFree(&driverState->nwfilters);
|
||||||
|
|
||||||
|
VIR_FREE(driverState->configDir);
|
||||||
|
nwfilterDriverUnlock(driverState);
|
||||||
|
}
|
||||||
|
|
||||||
VIR_FREE(driverState->configDir);
|
|
||||||
nwfilterDriverUnlock(driverState);
|
|
||||||
virMutexDestroy(&driverState->lock);
|
virMutexDestroy(&driverState->lock);
|
||||||
VIR_FREE(driverState);
|
VIR_FREE(driverState);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user