|
|
43fe83 |
From 7567ea478b7235bc19569c8da99a30b56af6473e Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <7567ea478b7235bc19569c8da99a30b56af6473e.1381871412.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
43fe83 |
Date: Mon, 14 Oct 2013 16:45:23 +0100
|
|
|
43fe83 |
Subject: [PATCH] nwfilter: Don't fail to start if DBus isn't available
|
|
|
43fe83 |
|
|
|
43fe83 |
For
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=927072
|
|
|
43fe83 |
|
|
|
43fe83 |
When the daemon is compiled with firewalld support but the DBus message
|
|
|
43fe83 |
bus isn't started in the system, the initialization of the nwfilter
|
|
|
43fe83 |
driver fails even if there are fallback options.
|
|
|
43fe83 |
|
|
|
43fe83 |
(cherry picked from commit e0e61b4cf75f246b9bc50452a307e1e4d996df4c)
|
|
|
43fe83 |
|
|
|
43fe83 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/nwfilter/nwfilter_driver.c | 9 +++++++--
|
|
|
43fe83 |
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
|
|
|
43fe83 |
index ce75c82..d25c6f2 100644
|
|
|
43fe83 |
--- a/src/nwfilter/nwfilter_driver.c
|
|
|
43fe83 |
+++ b/src/nwfilter/nwfilter_driver.c
|
|
|
43fe83 |
@@ -175,7 +175,8 @@ nwfilterStateInitialize(bool privileged,
|
|
|
43fe83 |
DBusConnection *sysbus = NULL;
|
|
|
43fe83 |
|
|
|
43fe83 |
#if WITH_DBUS
|
|
|
43fe83 |
- sysbus = virDBusGetSystemBus();
|
|
|
43fe83 |
+ if (virDBusHasSystemBus())
|
|
|
43fe83 |
+ sysbus = virDBusGetSystemBus();
|
|
|
43fe83 |
#endif /* WITH_DBUS */
|
|
|
43fe83 |
|
|
|
43fe83 |
if (VIR_ALLOC(driverState) < 0)
|
|
|
43fe83 |
@@ -184,6 +185,7 @@ nwfilterStateInitialize(bool privileged,
|
|
|
43fe83 |
if (virMutexInit(&driverState->lock) < 0)
|
|
|
43fe83 |
goto err_free_driverstate;
|
|
|
43fe83 |
|
|
|
43fe83 |
+ /* remember that we are going to use firewalld */
|
|
|
43fe83 |
driverState->watchingFirewallD = (sysbus != NULL);
|
|
|
43fe83 |
driverState->privileged = privileged;
|
|
|
43fe83 |
|
|
|
43fe83 |
@@ -209,7 +211,8 @@ nwfilterStateInitialize(bool privileged,
|
|
|
43fe83 |
* startup the DBus late so we don't get a reload signal while
|
|
|
43fe83 |
* initializing
|
|
|
43fe83 |
*/
|
|
|
43fe83 |
- if (nwfilterDriverInstallDBusMatches(sysbus) < 0) {
|
|
|
43fe83 |
+ if (sysbus &&
|
|
|
43fe83 |
+ nwfilterDriverInstallDBusMatches(sysbus) < 0) {
|
|
|
43fe83 |
VIR_ERROR(_("DBus matches could not be installed. Disabling nwfilter "
|
|
|
43fe83 |
"driver"));
|
|
|
43fe83 |
/*
|
|
|
43fe83 |
@@ -217,6 +220,8 @@ nwfilterStateInitialize(bool privileged,
|
|
|
43fe83 |
* may have caused the ebiptables driver to use the firewall tool
|
|
|
43fe83 |
* but now that the watches don't work, we just disable the nwfilter
|
|
|
43fe83 |
* driver
|
|
|
43fe83 |
+ *
|
|
|
43fe83 |
+ * This may only happen if the system bus is available.
|
|
|
43fe83 |
*/
|
|
|
43fe83 |
goto error;
|
|
|
43fe83 |
}
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.3.2
|
|
|
43fe83 |
|