From 1e742e0fb48db1756f9887fdb145f2da85c60066 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 9 Dec 2019 09:02:24 +0100 Subject: [PATCH] ifcfg: don't use D-Bus connection if NMDBusManager is without main connection In configure-and-quit mode, NMDBusManager does not have a D-Bus connection. Likewise, ifcfg-rh plugin should not use one either. --- src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c index 19c4f51eb4..c1396f7381 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c @@ -20,6 +20,7 @@ #include "nm-utils.h" #include "nm-core-internal.h" #include "nm-config.h" +#include "nm-dbus-manager.h" #include "settings/nm-settings-plugin.h" #include "settings/nm-settings-utils.h" #include "NetworkManagerUtils.h" @@ -1132,6 +1133,11 @@ _dbus_setup (NMSIfcfgRHPlugin *self) _dbus_clear (self); + if (!NM_MAIN_DBUS_CONNECTION_GET) { + _LOGW ("dbus: don't use D-Bus for %s service", IFCFGRH1_BUS_NAME); + return; + } + /* We use a separate D-Bus connection so that org.freedesktop.NetworkManager and com.redhat.ifcfgrh1 * are exported by different connections. */ address = g_dbus_address_get_for_bus_sync (G_BUS_TYPE_SYSTEM, NULL, &error);