提交 e0e61b4c 编写于 作者: P Peter Krempa

nwfilter: Don't fail to start if DBus isn't available

When the daemon is compiled with firewalld support but the DBus message
bus isn't started in the system, the initialization of the nwfilter
driver fails even if there are fallback options.
上级 ee3db56f
...@@ -175,7 +175,8 @@ nwfilterStateInitialize(bool privileged, ...@@ -175,7 +175,8 @@ nwfilterStateInitialize(bool privileged,
DBusConnection *sysbus = NULL; DBusConnection *sysbus = NULL;
#if WITH_DBUS #if WITH_DBUS
sysbus = virDBusGetSystemBus(); if (virDBusHasSystemBus())
sysbus = virDBusGetSystemBus();
#endif /* WITH_DBUS */ #endif /* WITH_DBUS */
if (VIR_ALLOC(driverState) < 0) if (VIR_ALLOC(driverState) < 0)
...@@ -184,6 +185,7 @@ nwfilterStateInitialize(bool privileged, ...@@ -184,6 +185,7 @@ nwfilterStateInitialize(bool privileged,
if (virMutexInit(&driverState->lock) < 0) if (virMutexInit(&driverState->lock) < 0)
goto err_free_driverstate; goto err_free_driverstate;
/* remember that we are going to use firewalld */
driverState->watchingFirewallD = (sysbus != NULL); driverState->watchingFirewallD = (sysbus != NULL);
driverState->privileged = privileged; driverState->privileged = privileged;
...@@ -208,7 +210,8 @@ nwfilterStateInitialize(bool privileged, ...@@ -208,7 +210,8 @@ nwfilterStateInitialize(bool privileged,
* startup the DBus late so we don't get a reload signal while * startup the DBus late so we don't get a reload signal while
* initializing * initializing
*/ */
if (nwfilterDriverInstallDBusMatches(sysbus) < 0) { if (sysbus &&
nwfilterDriverInstallDBusMatches(sysbus) < 0) {
VIR_ERROR(_("DBus matches could not be installed. Disabling nwfilter " VIR_ERROR(_("DBus matches could not be installed. Disabling nwfilter "
"driver")); "driver"));
/* /*
...@@ -216,6 +219,8 @@ nwfilterStateInitialize(bool privileged, ...@@ -216,6 +219,8 @@ nwfilterStateInitialize(bool privileged,
* may have caused the ebiptables driver to use the firewall tool * may have caused the ebiptables driver to use the firewall tool
* but now that the watches don't work, we just disable the nwfilter * but now that the watches don't work, we just disable the nwfilter
* driver * driver
*
* This may only happen if the system bus is available.
*/ */
goto error; goto error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册